使用php artisan route:list 报错
1. 运行环境
php内置环境
1). 当前使用的 Laravel 版本?
Laravel Framework 9.33.0
2). 当前使用的 php/php-fpm 版本?
PHP 版本:php 8.1.8
php-fpm 版本:
3). 当前系统
windows 11
4). 业务环境
开发环境
5). 相关软件版本
mysql 5.7.26
2. 问题描述?
Route::resource('users', 'UsersController');
设置完路由后,使用php artisan route:list 命令后报错
Illuminate\Contracts\Container\BindingResolutionException
Target class [UsersController] does not exist.
at D:\phpstudy_pro\Wang\weibo\vendor\laravel\framework\src\Illuminate\Containe
r\Container.php:877
873▕
874▕ try {
875▕ $reflector = new ReflectionClass($concrete);
876▕ } catch (ReflectionException $e) {
➜ 877▕ throw new BindingResolutionException(“Target class [$concre
te] does not exist.”, 0, $e);
878▕ }
879▕
880▕ // If the type is not instantiable, the developer is attempting
to resolve
881▕ // an abstract type such as an Interface or Abstract Class and
there is
3. 您期望得到的结果?
可以正常使用php artisan route:list命令
4. 您实际得到的结果?
使用php artisan route:list命令报错
不知道怎么回事
有人?
好了,解决了,使用 Route::resource('users', App\Http\Controllers\UserController::class);