[英]Call to undefined function mime_content_type(), can't change server settings
I have the error found in the title (Call to undefined function mime_content_type()
). 我在标题中找到了错误(调用未定义函数mime_content_type()
)。 I've read about re-compiling PHP, as well as using finfo_open(FILEINFO_MIME_TYPE);
我读过关于重新编译PHP的内容,以及使用finfo_open(FILEINFO_MIME_TYPE);
. 。 The problem with the latter is that my PHP version is 5.2.15, which is too old to support finfo
, so I switched to mime_content_type()
(which is cleaner, in my opinion), but my server doesn't support that either! 后者的问题是我的PHP版本是5.2.15,它太旧了,不支持finfo
,所以我切换到mime_content_type()
(在我看来更干净),但我的服务器也不支持!
My question is this: can I use ini_set()
to set a value so I can use mime_content_type()
, or is there another (hackier maybe) way to get a file's mime type? 我的问题是这样的:我可以使用ini_set()
来设置一个值,这样我可以使用mime_content_type()
,还是有另一种(hackier)方式来获取文件的mime类型?
Here is my PHPinfo(): http://staging.cliquesoft.org/cs/infos.php 这是我的PHPinfo(): http ://staging.cliquesoft.org/cs/infos.php
Thanks for any help. 谢谢你的帮助。
You can use the reimplementation from http://upgradephp.berlios.de/ . 您可以使用http://upgradephp.berlios.de/中的重新实现。 It defines te mime_content_type
function if missing. 如果缺少,它定义te mime_content_type
函数。 You find it in include("ext/mime.php");
你在include("ext/mime.php");
找到它include("ext/mime.php");
There's also a version in PEARs PHP_Compat . PEARs PHP_Compat中还有一个版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.