调用未定义的函数mime_content_type(),无法更改服务器设置 [英] Call to undefined function mime_content_type(), can't change server settings
问题描述
我在标题中发现错误(调用未定义函数mime_content_type()
).我已经读过有关重新编译PHP以及使用finfo_open(FILEINFO_MIME_TYPE);
的信息.后者的问题是我的PHP版本是5.2.15,它的版本太旧而不能支持finfo
,所以我切换到了mime_content_type()
(我认为这更干净),但是我的服务器不支持该版本.要么!
I have the error found in the title (Call to undefined function mime_content_type()
). I've read about re-compiling PHP, as well as using 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!
我的问题是:我可以使用ini_set()
设置一个值以便使用mime_content_type()
,还是有另一种(可能是黑客)获取文件的mime类型的方法?
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?
这是我的PHPinfo(): http://staging.cliquesoft.org/cs/infos .php
Here is my PHPinfo(): http://staging.cliquesoft.org/cs/infos.php
感谢您的帮助.
推荐答案
您可以使用 http://upgradephp.berlios.de/中的重新实现.如果缺少,它定义te mime_content_type
函数.您可以在include("ext/mime.php");
You can use the reimplementation from http://upgradephp.berlios.de/. It defines te mime_content_type
function if missing. You find it in include("ext/mime.php");
PEARs中也有一个版本 PHP_Compat .
There's also a version in PEARs PHP_Compat.
这篇关于调用未定义的函数mime_content_type(),无法更改服务器设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!