清理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.3 | wp-includes/formatting.php:5397 | 0 | 2 |
笔记(Notes)
基本用法