为什么不推荐在PHP中使用mime_content_type()? [英] Why is mime_content_type() deprecated in PHP?
本文介绍了为什么不推荐在PHP中使用mime_content_type()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是想知道为什么 mime_content_type()现在被视为已弃用.
I'm just curious to know why mime_content_type() is now considered deprecated.
这种确定mime类型的方法比替换 Fileinfo 功能.
This method for determining the mime type is much easier than the replacement Fileinfo functionality.
推荐答案
我想这是因为Fileinfo可以返回有关文件的更多信息.
I guess it's because Fileinfo can return more information about files.
这是替换黑客:
function _mime_content_type($filename) {
$result = new finfo();
if (is_resource($result) === true) {
return $result->file($filename, FILEINFO_MIME_TYPE);
}
return false;
}
这篇关于为什么不推荐在PHP中使用mime_content_type()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文