使用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命令报错


《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
讨论数量: 4

好了,解决了,使用 Route::resource('users', App\Http\Controllers\UserController::class);

1年前 评论
晓飞 1年前

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!