wp_ext2type() - WordPress 函数参考中文文档

返回介绍

wp_ext2type()

发布于 2017-09-11 字数 1403 浏览 894 评论 0

wp_ext2type( string $ext )

Retrieve the file type based on the extension name.


描述


参数

$ext

(string)
(Required)
The extension to search.


返回值

(string|void) The file type, example: audio, video, document, spreadsheet, etc.


源代码

File: wp-includes/functions.php

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

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

更新日志

Version 描述
2.5.0 Introduced.

相关函数

Uses

  • wp-includes/functions.php:
    wp_get_ext_types()

Used By

  • wp-admin/includes/media.php:
    wp_media_upload_handler()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_send_link_to_editor()
  • wp-includes/post.php:
    wp_mime_type_icon()

User Contributed Notes

上一篇:wp_explain_nonce()

下一篇:wp_extract_urls()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!