导航首页 »  技术教程 »  PHP:mime_content_type()的用法_fileinfo函数
PHP:mime_content_type()的用法_fileinfo函数 1090 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 作为替代。



文章评论 (0条)
发表评论
暂无评论,快来抢沙发吧~