容器中的反射异常.php类图像不存在以进行干预


ReflectionException in Container.php Class image does not exist for intervention

我试图使用laravel保存来自POST请求的图像。 但它给了我以下错误。

容器中的反射异常.php第 741 行:类图像不存在

我做了以下事情:在 php.ini 文件中启用文件信息扩展名和composer dumpautoload但没有什么是工作,我遵循了这里的指南线我正在使用拉拉维尔 5.1

我的代码就像波纹管一样

public function saveImage(){
    Image::make(Input::file('files')->getRealPath())
        ->resize(870, null, true, false)
        ->save('foo.jpg');
}
您是否在

文档顶部包含该类?

use Intervention'Image'ImageManagerStatic as Image;

我设法通过将以下内容添加到配置/应用程序中来解决此问题.php

 'providers' => [
        Intervention'Image'ImageServiceProvider::class
    ],
    
    'aliases' => [
        'Image'     => Intervention'Image'Facades'Image::class
    ],