本文介绍了发布上传图片,调用未定义函数finfo_buffer()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试通过基于Laravel框架的脚本上传图像并遇到此错误:

Trying to upload an image via a script based on Laravel framework and coming across this error:

Call to undefined function Intervention\Image\finfo_buffer() 

     * Checks if string contains binary image data
*
* @param mixed $input
* @return boolean
*/
private function isBinary($input)
{
$mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), (string) $input);
return substr($mime, 0, 4) != 'text';
}

我对Laravel并不十分精通,因此不胜感激.

I'm not really that well versed on Laravel so would appreciate some help.

致谢

推荐答案

您需要为PHP启用fileinfo扩展名.参见对未定义函数Intervention \ Image \ finfo_buffer()的调用.

You need fileinfo extension enabled for your PHP. See Call to undefined function Intervention\Image\finfo_buffer().

ext-fileinfo现在是安装必需的.

ext-fileinfo is now required for installation.

检查您的php.ini文件,以查看是否注释掉了extension=php_fileinfo.dllextension=fileinfo.so行中的内容.如果是这样,请取消注释并重新启动Web服务器.

Check your php.ini file to see if something along the line of extension=php_fileinfo.dll or extension=fileinfo.so is commented out. If so uncomment it and restart your web server.

这篇关于发布上传图片,调用未定义函数finfo_buffer()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 17:56