导航首页 » 技术教程 » PHP:mime_content_type()的用法_fileinfo函数
PHP:mime_content_type()的用法_fileinfo函数 136 2023-12-15   

mime_content_type

(PHP 4 >= 4.3.0, PHP 5)

mime_content_type — 检测文件的 MIME 类型(已废弃)

说明

string mime_content_type ( string $filename )

返回通过使用 magic.mime 检测到的文件 MIME 类型。

参数

filename

要检测的文件名。

返回值

返回文件的 MIME 内容类型,例如 text/plain 或 application/octet-stream。

注释

Warning

由于 PECL Fileinfo 扩展 以更清晰的方式提供了更多的功能, 所以本函数已被废弃。

范例

Example #1 mime_content_type() 示例

<?php
echo mime_content_type('php.gif') . "n";
echo mime_content_type('test.php');
?>

以上例程会输出:

image/gif
text/plain

参见

使用 Fileinfo 作为替代。


!!!站长长期在线接!!!

网站、小程序:定制开发/二次开发/仿制开发等

各种疑难杂症解决/定制接口/定制采集等

站长微信:lxwl520520

站长QQ:1737366103