WordPress开发者和主题制作者的搜索引擎



sanitize_mime_type ›

Since3.1.3
已弃用n/a
sanitize_mime_type ( $mime_type )
参数:
  • (string) $mime_type Mime type
    Required: Yes
返回:
  • (string) Sanitized mime type
定义在:
文档:

Sanitize a mime type



源码

function sanitize_mime_type( $mime_type ) {
	$sani_mime_type = preg_replace( '/[^-+*.a-zA-Z0-9\/]/', '', $mime_type );
	/**
	 * Filters 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 );
}