PHP fileinfo是未定义的函数 [英] PHP fileinfo is undefined function
问题描述
每当我尝试从php获取mime内容类型时,它都会回显:
致命错误:在 4 行的/home/jobynadel/finadel.com/video/finfo.php 中找不到"finfo"类>
或
致命错误:在第 4 行的/home/jobynadel/finadel.com/video/finfo.php 中调用未定义的函数finfo_open
我只是想不通!
我正在使用的代码是:
$file_info = new finfo(FILEINFO_MIME_TYPE);
// See constant value http://php.net/manual/en/fileinfo.constants.php#113687
$mime_type = $file_info->buffer(file_get_contents($file));
查看您的php.ini文件,并检查fileinfo.so
或php_fileinfo.dll
是否已激活(取决于您的平台和版本).>
应该有一行类似于
extension=fileinfo.so
在您的php.ini文件中
Whenever I try to get the mime content type from php, it echos:
Fatal error: Class 'finfo' not found in /home/jobynadel/finadel.com/video/finfo.php on line 4
or
Fatal error: Call to undefined function finfo_open in /home/jobynadel/finadel.com/video/finfo.php on line 4
I just can't figure it out!
The code I am using is:
$file_info = new finfo(FILEINFO_MIME_TYPE);
// See constant value http://php.net/manual/en/fileinfo.constants.php#113687
$mime_type = $file_info->buffer(file_get_contents($file));
Have a look at your php.ini file and check that the fileinfo.so
or php_fileinfo.dll
is activated (depending on your platform and version).
There should be a line similar to
extension=fileinfo.so
in your php.ini file
这篇关于PHP fileinfo是未定义的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!