Laravel 流明图像验证无效
Laravel Lumen image validation is not working
我正在将请求验证为图像,但出现崩溃并提示:
"Unable to guess the MIME type as no guessers are available (have you
enable the php_fileinfo extension?)".
在 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部分:
;;;;;;;;;;;;;;;;;;;;;;
; 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
中找到了文件
我发现了问题。我有另一个 php.ini 文件,在 C:\php\php.ini
中有注释行 ;extension=fileinfo
(我打开的文件在 C:\xampp\php\php.ini
中)。现在我重新启动了 Apache,它开始工作了!
我正在将请求验证为图像,但出现崩溃并提示:
"Unable to guess the MIME type as no guessers are available (have you enable the php_fileinfo extension?)".
在 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部分:
;;;;;;;;;;;;;;;;;;;;;;
; 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
我发现了问题。我有另一个 php.ini 文件,在 C:\php\php.ini
中有注释行 ;extension=fileinfo
(我打开的文件在 C:\xampp\php\php.ini
中)。现在我重新启动了 Apache,它开始工作了!