本文介绍了Laravel 6.0 php artisan route:list返回“目标类[App \ Http \ Controllers \ SessionsController]不存在."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Laravel 6.0,并且尝试使用artisan route:list列出我的所有路线,但失败并返回:

I am using Laravel 6.0 and I try to list all my routes with artisan route:list, but it fails and returns:

802 | 803 |尝试 { 804 | $ reflector = new ReflectionClass($ concrete); 805 | } catch(ReflectionException $ e){

at /home/vagrant/code/vendor/laravel/framework/src/Illuminate/Container/Container.php:806 802| 803| try { 804| $reflector = new ReflectionClass($concrete); 805| } catch (ReflectionException $e) {

异常跟踪:

1 Illuminate \ Foundation \ Console \ RouteListCommand :: Illuminate \ Foundation \ Console {closure}(Object(Illuminate \ Routing \ Route)) [内部]:0

1 Illuminate\Foundation\Console\RouteListCommand::Illuminate\Foundation\Console{closure}(Object(Illuminate\Routing\Route)) [internal]:0

2 ReflectionException::(类App \ Http \ Controllers \ SessionsController不存在") /home/vagrant/code/vendor/laravel/framework/src/Illuminate/Container/Container.php:804

2 ReflectionException::("Class App\Http\Controllers\SessionsController does not exist") /home/vagrant/code/vendor/laravel/framework/src/Illuminate/Container/Container.php:804

3 ReflectionClass :: __ construct("App \ Http \ Controllers \ SessionsController") /home/vagrant/code/vendor/laravel/framework/src/Illuminate/Container/Container.php:804

3 ReflectionClass::__construct("App\Http\Controllers\SessionsController") /home/vagrant/code/vendor/laravel/framework/src/Illuminate/Container/Container.php:804

到目前为止,我只有一个非常简单的web.php路由文件:

Up to now I just have a very simple web.php routes file:

Route::get('/', function () {
    return view('index');
});


Route::prefix('app')->group(function () {
    // Registration routes
    Route::get('registration/create', 'RegistrationController@create')->name('app-registration-form');
});


// Templates
Route::get('templates/ubold/{any}', 'UboldController@index');

有什么主意我可以调试这个问题吗?

Any idea how I could debug this issue?

非常感谢!

推荐答案

运行此命令

  php artisan config:cache

这篇关于Laravel 6.0 php artisan route:list返回“目标类[App \ Http \ Controllers \ SessionsController]不存在."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 15:49