我正在将请求验证为图像,但崩溃时说:“由于没有可用的猜测器,因此无法猜测MIME类型(是否启用了php_fileinfo扩展名?)。]]
在php.ini中,我没有extension = php_fileinfo,但确实有一个extension = fileinfo未注释的行(我看到Lumen将这个和其他依赖项放在不带'php_'的位置)。我也尝试添加extension = php_fileinfo,但是当我从XAMPP重新启动Apache时,它崩溃了,因为它找不到该依赖项。我该怎么办?
代码:
function updateProfilePicture(Request $request) { $this->validate($request, [ 'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048' ]); //...
php.ini部分,其中fileinfo依赖项是:
;;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions ; ;;;;;;;;;;;;;;;;;;;;;; ; If you wish to have an extension loaded automatically, use the following ; syntax: ; ; extension=modulename ; ; For example: ; ; extension=mysqli ; ; When the extension library to load is not located in the default extension ; directory, You may specify an absolute path to the library file: ; ; extension=/path/to/extension/mysqli.so ; ; Note : The syntax used in previous PHP versions ('extension=<ext>.so' and ; 'extension='php_<ext>.dll') is supported for legacy reasons and may be ; deprecated in a future PHP major version. So, when it is possible, please ; move to the new ('extension=<ext>) syntax. ; ; Notes for Windows environments : ; ; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+) ; extension folders as well as the separate PECL DLL download (PHP 5+). ; Be sure to appropriately set the extension_dir directive. ; extension=bz2 extension=curl extension=fileinfo extension=gd2 extension=gettext
也许与有关如何设置依赖项指令的免责声明有关? (我不确定,因为extension = fileinfo作为默认文件已存在于文件中)我正在使用Windows 10,并且在C:\ xampp \ php \ ext \ php_fileinfo.dll]中找到了文件
我正在将请求验证为图像,但崩溃时说:“由于没有可用的猜测器,因此无法猜测MIME类型(是否启用了php_fileinfo扩展名?)”。在php.ini中,我没有...
我发现了问题。我在C:\ php \ php.ini中有另一个带有注释行;extension=fileinfo
的php.ini文件(我打开的文件在C:\ xampp \ php \ php.ini中)。现在,我重新启动了Apache,它正在工作!