wp_ext2type

函数


wp_ext2type ( $ext )
参数
  • (string)
    $ext
    The extension to search.
    Required:
返回值
  • (string|void) The file type, example: audio, video, document, spreadsheet, etc.
定义位置
  • wp-includes/functions.php
    , line 2971
引入
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;
		}
	}
}