sanitize_mime_type()清理 mine type

目录

描述

清理 mine type。

sanitize_mime_type()    成时候,会   sanitize_mime_type   器。

sanitize_mime_type() 描述

用法

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
<?php sanitize_mime_type( $mime_type ); ?>

sanitize_mime_type() 用法

参数

$mime_type

(string) (必填) Mime Type

默认值: None

sanitize_mime_type() 参数

返回值

(string) 

清理之后的 mime type

sanitize_mime_type() 返回值

注意

Filters

  • 'sanitize_mime_type':
    apply_filters( 'sanitize_mime_type', $sanitized_mime_type, $raw_mime_type )

sanitize_mime_type() 注意

历史

添加于 版本: 3.1.3

sanitize_mime_type() 历史

源文件

sanitize_mime_type() 函数的代码位于 /wp-includes/formatting.php.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * 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 );
}

sanitize_mime_type() 源文件