PHP fileinfo是未定义的函数 [英] PHP fileinfo is undefined function

查看:111
本文介绍了PHP fileinfo是未定义的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试从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.sophp_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.soor 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屋!

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