wp_ext2type

函数
wp_ext2type ( $ext )
参数
  • (string) $ext The extension to search.
    Required:
返回值
  • (string|void) The file type, example: audio, video, document, spreadsheet, etc.
定义位置
相关方法
wp_get_ext_typeswp_get_mime_typeswp_get_httpwp_titlewp_exif_date2ts
引入
2.5.0
弃用
-

根据扩展名检索文件类型。

function wp_ext2type( $ext ) {
	$ext = strtolower( $ext );

	$ext2type = wp_get_ext_types();
	foreach ( $ext2type as $type => $exts ) {
		if ( in_array( $ext, $exts, true ) ) {
			return $type;
		}
	}
}