使用干预时未找到图像类

Joe*_*e W 1 php laravel intervention laravel-5.2

我已经安装了Laravel 5.2和Intervention,现在它在项目的composer.json文件中.

"require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*",
        "intervention/image": "^2.3"
    },
Run Code Online (Sandbox Code Playgroud)

阅读完教程后,它会提到一个Image.php文件,一旦安装了Intervention,它应该位于项目内的config文件夹中.我相信我已经正确安装了干预,但是当我尝试使用干预功能时,它不起作用.

当我尝试使用这行代码时,我得到了这个错误

$resizedImg = Image::make($path)->resize(200,200);

C:\xampp\htdocs\socialNet\vendor\laravel\framework\src\Illuminate\Container\Container.php line 738:
Run Code Online (Sandbox Code Playgroud)

类图像不存在

在我使用此函数的文件中,我包含此Use语句

use Intervention\Image\Facades\Image as Image;
Run Code Online (Sandbox Code Playgroud)

Abh*_*hek 13

在你的app.php中添加以下内容aliases:

'Image' => Intervention\Image\Facades\Image::class,
Run Code Online (Sandbox Code Playgroud)

在你的 providers

Intervention\Image\ImageServiceProvider::class,
Run Code Online (Sandbox Code Playgroud)

别忘了php artisan config:cache在此之后做.