在PHP中检测MIME类型 [英] Detecting MIME type in PHP

查看:64
本文介绍了在PHP中检测MIME类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找检测PHP中文件MIME类型的最佳方法(可能在大多数PHP 5.2安装中并且仍在积极开发中).

I'm looking for the best (possible on most PHP 5.2 installs and still actively developed) way to detect a files MIME type in PHP.

我知道mime_content_type()方法和Fileinfo扩展名,但是mime_content_type()是不可靠和不推荐使用的,并且Fileinfo不在标准" PHP(5.2)安装中.

I'm aware of the mime_content_type() method and the Fileinfo extension, however mime_content_type() is unreliable and deprecated, and Fileinfo doesn't come in a "standard" PHP (5.2) install.

我还有其他选择吗?

推荐答案

您是否研究过此PEAR软件包?

Have you looked into this PEAR package?

http://pear.php.net/package/MIME_Type

这篇关于在PHP中检测MIME类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆