php中mimes函数,wordpress函数check_upload_mimes()用法示例
check_upload_mimes( array $mimes )
Check an array of MIME types against a whitelist.
描述
WordPress ships with a set of allowed upload filetypes, which is defined in wp-includes/functions.php in get_allowed_mime_types(). This function is used to filter that list against the filetype whitelist provided by Multisite Super Admins at wp-admin/network/settings.php.
参数
$mimes
(array)
(Required)
返回值
(array)
源代码
File: wp-includes/ms-functions.php
function check_upload_mimes( $mimes ) {
$site_exts = explode( ' ', get_site_option( 'upload_filetypes', 'jpg jpeg png gif' ) );
$site_mimes = array();
foreach ( $site_exts as $ext ) {
foreach ( $mimes as $ext_pattern => $mime ) {
if ( $ext != '' && strpos( $ext_pattern, $ext ) !== false )
$site_mimes[$ext_pattern] = $mime;
}
}
return $site_mimes;
}
更新日志
Version
描述
MU
Introduced.
相关函数
Uses
wp-includes/option.php:
get_site_option()
Skip to note content
You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note
Contributed by Codex
Get allowed MIME types
$mimes = array(
'jpg|jpeg|jpe' => 'image/jpeg',
'php' => 'application/x-php', // This isn't on the whitelist!
);
$mimes = check_upload_mimes( $mimes );
print_r( $mimes );
Output:
Array( 'jpg|jpeg|jpe' => 'image/jpeg' )
php中mimes函数,wordpress函数check_upload_mimes()用法示例相关推荐
- php 字符串函数 教程_php字符串函数 str类常见用法示例
本文实例讲述了php字符串函数 str类常见用法.分享给大家供大家参考,具体如下: str_split(string, leg);//将一个字符 串转换为数组,参数1:要被转换的字符串,参数2:每 段 ...
- PHP Calendar 函数,wordpress函数get_calendar()用法示例
get_calendar( bool $initial = true, bool $echo = true ) Display calendar with days that have posts a ...
- html class函数,wordpress函数sanitize_html_class()用法示例
sanitize_html_class( string $class, string $fallback = '' ) Sanitizes an HTML classname to ensure it ...
- C语言中time函数的定义及用法示例
头文件time.h @函数名称: localtime 函数原型: struct tm *localtime(const time_t *timer) 函数功能: 返回一个以tm结构表达的机器时间信息 ...
- python中的statistics_Python统计分析模块statistics用法示例
本文实例讲述了Python统计分析模块statistics用法.分享给大家供大家参考,具体如下: 一 计算平均数函数mean() >>>import statistics >& ...
- c++头文件iomanip.h中setw()、setprecision()、setbase用法示例详解
c++头文件iomanip.h中setw().setprecision().setbase #include <iostream> //不要用iostream.h ,会出现好多问题 ...
- android 方法拦截器,Android的OkHttp包中的HTTP拦截器Interceptor用法示例
OkHttp(GitHub:https://github.com/square/okhttp) 的 Interceptor 就如同名称「拦截器」一样,拦截你的 Request 做一些你想做的事情再送出 ...
- php theexcerpt,wordpress的excerpt()函数的用法示例
本篇文章给大家带来的内容是关于wordpress的excerpt()函数的用法示例,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. 问题:在wordpres中的single页面,本身引 ...
- python threading join_Python中threading模块join函数用法实例分析
本文实例讲述了Python中threading模块join函数用法.分享给大家供大家参考.具体分析如下: join的作用是众所周知的,阻塞进程直到线程执行完毕.通用的做法是我们启动一批线程,最后joi ...
最新文章
- [emuch.net]MatrixComputations(1-6)
- android 初始化语言,3.4.1 Android初始化语言(1)
- Pandas中xs()函数索引复合索引数据的不同切面数据(索引复合索引中需要的数据):索引列复合索引中的一个切面、索引行复合索引中的一个切面
- Ubuntu16.04 -- 后台进程Nohup
- mysql权限配置文件_MySQL权限管理、配置文件(三)
- Docker容器私有仓库——Harbor私有仓库的搭建
- mysql脚本解读_一篇很好的关于mysqld_safe脚本源码解读的文章,收藏了!!
- AsnycTask的内部的实现机制
- Atitit mybatis快速开发 的sql api接口
- 基于java+swing的物业收费管理系统(java+swing+Gui)
- 基于海康威视IP摄像头和虹软的MFC人脸识别系统开发教程
- 纯前端word导出echarts图表
- Java中Scanner的进阶---求和与求平均数
- 用户头像的背景为头像的模糊头像时候
- 单片机产生可调方波(c语言),为什么我用单片机做的频率可调的方波输出会有尖刺,而且会断...
- C++--【基础】--HEX、DEC、OCT数据转换
- 小测试--在Windows server 2016中启用RemoteFX-GPU虚拟化功能
- 破解网吧电影,获取电影的实际地址!
- word如何设置上标形式_word怎样设置上标
- 道理我都懂,但是这种列车为什么会自己摆动?
热门文章
- 上传大文件:在 System.Web.HttpRequest.GetEntireRawContent()
- 学习 python logging(1): 基本用法
- C#操作DataReader类
- 新建maven的pom.xml第一行出错的解决思路
- Loader 知识梳理(2) initLoader和restartLoader的区别
- Flex DataGrid 筛选实现
- 如何把SQLServer数据库从高版本降级到低版本?
- IBM Power System P550双机系统方案
- 求整数的位数及各位数字之和(C语言)
- C语言显示相位的程序,【图片】求助大佬用c语言帮忙编写下程序【c程序吧】_百度贴吧...