首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

mime_content_type

(PHP 4 >= 4.3.0, PHP 5, PHP 7)

mime_content_type - 检测文件的MIME内容类型

描述

代码语言:javascript
复制
string mime_content_type ( string $filename )

通过使用magic.mime文件中的信息确定文件的MIME内容类型。

参数

filename

测试文件的路径。

返回值

以MIME格式返回内容类型,如text/plainapplication/octet-stream

示例

Example #1 mime_content_type() Example

代码语言:javascript
复制
<?php
echo mime_content_type('php.gif') . "\n";
echo mime_content_type('test.php');
?>

上面的例子将输出:

代码语言:javascript
复制
image/gif
text/plain

另请参阅

  • finfo_file() - Alias of finfo_file()
  • finfo_buffer() - Alias of finfo_buffer()

← finfo_set_flags

finfo →

扫码关注腾讯云开发者

领取腾讯云代金券