sanitize_mime_type()

清理mime类型

sanitize_mime_type(string $mime_type)

参数(Parameters)

参数类型必填说明
$mime_type(string)必需Mime类型

返回(Return)

(string)净化的mime类型


源码(Source)

/**
 * Sanitize a mime type
 *
 * @since 3.1.3
 *
 * @param string $mime_type Mime type
 * @return string Sanitized mime type
 */
function sanitize_mime_type( $mime_type ) {
	$sani_mime_type = preg_replace( '/[^-+*.a-zA-Z0-9/]/', '', $mime_type );
	/**
	 * Filter a mime type following sanitization.
	 *
	 * @since 3.1.3
	 *
	 * @param string $sani_mime_type The sanitized mime type.
	 * @param string $mime_type      The mime type prior to sanitization.
	 */
	return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type );
}
更新版本源码位置使用被使用
3.1.3wp-includes/formatting.php:539702

笔记(Notes)

基本用法

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索