2

我正在运行 Laravel 6 和 PHP 7.2,但出现此错误:

Illuminate\Contracts\Container\BindingResolutionException 抛出消息“目标类 [加密器] 不存在。”

堆栈跟踪:

#14 Illuminate\Contracts\Container\BindingResolutionException in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:806
#13 ReflectionException in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:804
#12 ReflectionClass:__construct in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:804
#11 Illuminate\Container\Container:build in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:682
#10 Illuminate\Container\Container:resolve in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:630
#9 Illuminate\Container\Container:make in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:768
#8 Illuminate\Foundation\Application:make in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:946
#7 Illuminate\Container\Container:resolveClass in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:874
#6 Illuminate\Container\Container:resolveDependencies in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:835
#5 Illuminate\Container\Container:build in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:682
#4 Illuminate\Container\Container:resolve in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Container/Container.php:630
#3 Illuminate\Container\Container:make in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:768
#2 Illuminate\Foundation\Application:make in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:215
#1 Illuminate\Foundation\Http\Kernel:terminateMiddleware in /Applications/MAMP/htdocs/kiri/kiriarabia/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:189
#0 Illuminate\Foundation\Http\Kernel:terminate in /Applications/MAMP/htdocs/kiri/kiriarabia/public/index.php:60

知道我需要解决什么吗?

4

3 回答 3

1

如果您已将类组织到子文件夹中,请检查命名空间——它也应该包含子文件夹。

于 2019-10-31T17:14:49.513 回答
0

当中间件不存在时,您可能会收到此异常。

让我们以以下路线为例:

Route::get('/products/{productId}', 'ProductController@view')
     ->middleware('some_middleware');

如果中间件some_middleware没有实现,那么你会得到异常Target class [some_middleware] does not exist

于 2020-03-09T16:11:54.343 回答
0

将旧的加密器中间件复制到新创建的项目中间件文件夹中。

于 2019-11-11T15:13:43.933 回答