mime_content_type
(PHP 4 >= 4.3.0, PHP 5, PHP 7)
mime_content_type - 检测文件的MIME内容类型
描述
string mime_content_type ( string $filename )
通过使用magic.mime文件中的信息确定文件的MIME内容类型。
参数
filename
测试文件的路径。
返回值
以MIME格式返回内容类型,如text/plain或application/octet-stream。
示例
Example #1 mime_content_type() Example
<?php
echo mime_content_type('php.gif') . "\n";
echo mime_content_type('test.php');
?>
上面的例子将输出:
image/gif
text/plain
另请参阅
- finfo_file() - Alias of finfo_file()
- finfo_buffer() - Alias of finfo_buffer()
← finfo_set_flags
finfo →
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com