课程'用户'新装完后没找到laravel 5.2

时间:2016-04-18 12:59:31

标签: php laravel laravel-5 laravel-5.2 laravel-routing

我刚刚按照文档中的指南安装了新的laravel 5.2应用程序 - https://laravel.com/docs/5.2#installing-laravel

这不是我第一次这样做,但我之前没有遇到过这样的问题。 我收到了这个错误:

routes.php第15行中的FatalThrowableError: 致命错误:班级'用户'找不到

我的routes.php我只有:

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

我无法理解问题所在。我在全新安装时出现此错误,之前从未遇到过此类问题。任何帮助将不胜感激。

这是一个包含错误的完整屏幕截图: Screenshot with error

错误列表:

FatalThrowableError in routes.php line 15:
Fatal error: Class 'User' not found
in routes.php line 15
at RouteServiceProvider->{closure}()
at call_user_func_array(object(Closure), array()) in Route.php line 158
at Route->runCallable(object(Request)) in Route.php line 137
at Route->run(object(Request)) in Router.php line 724
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Router.php line 726
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 699
at Router->dispatchToRoute(object(Request)) in Router.php line 675
at Router->dispatch(object(Request)) in Kernel.php line 246
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Kernel.php line 132
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
at Kernel->handle(object(Request)) in index.php line 53

完整routes.php文件:

<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

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

1 个答案:

答案 0 :(得分:1)

php artisan clear-compiled  
php artisan optmize

那对我有帮助!谢谢大家!

相关问题