我剛接收新項目,遇到阻塞問題。
如果沒有它引發以下錯誤任何參數運行php artisan
:正在運行php工匠:找不到類「路由」
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Route' not found
當運行網站的主頁,我有一個例外,在日誌中的堆棧跟蹤如下:
[2017-07-17 13:07:07] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Class 'Route' not found in C:\wamp64\www\myproject\routes\api.php:16
Stack trace:
#0 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Routing\Router.php(329): require()
#1 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Routing\Router.php(285): Illuminate\Routing\Router->loadRoutes('C:\\wamp64\\www\\S...')
#2 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Routing\RouteRegistrar.php(104): Illuminate\Routing\Router->group(Array, 'C:\\wamp64\\www\\S...')
#3 C:\wamp64\www\myproject\app\Providers\RouteServiceProvider.php(71): Illuminate\Routing\RouteRegistrar->group('C:\\wamp64\\www\\S...')
#4 C:\wamp64\www\myproject\app\Providers\RouteServiceProvider.php(38): App\Providers\RouteServiceProvider->mapApiRoutes()
#5 [internal function]: App\Providers\RouteServiceProvider->map()
#6 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(29): call_user_func_array(Array, Array)
#7 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#8 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#9 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Container\Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#10 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Foundation\Support\Providers\RouteServiceProvider.php(71): Illuminate\Container\Container->call(Array)
#11 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Foundation\Support\Providers\RouteServiceProvider.php(30): Illuminate\Foundation\Support\Providers\RouteServiceProvider->loadRoutes()
#12 C:\wamp64\www\myproject\app\Providers\RouteServiceProvider.php(28): Illuminate\Foundation\Support\Providers\RouteServiceProvider->boot()
#13 [internal function]: App\Providers\RouteServiceProvider->boot()
#14 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(29): call_user_func_array(Array, Array)
#15 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#16 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#17 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Container\Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#18 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(788): Illuminate\Container\Container->call(Array)
#19 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(771): Illuminate\Foundation\Application->bootProvider(Object(App\Providers\RouteServiceProvider))
#20 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(App\Providers\RouteServiceProvider), 17)
#21 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(772): array_walk(Array, Object(Closure))
#22 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\BootProviders.php(17): Illuminate\Foundation\Application->boot()
#23 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(208): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#24 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(162): Illuminate\Foundation\Application->bootstrapWith(Array)
#25 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(146): Illuminate\Foundation\Http\Kernel->bootstrap()
#26 C:\wamp64\www\myproject\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#27 C:\wamp64\www\myproject\public\index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#28 {main}
我對laravel很陌生,所以這可能是一個新手的錯誤,但我沒有設法自己找到一個解決方案。有人能幫我嗎 ?
謝謝你的時間。
編輯:
罪魁禍首是誰想要在config/app.php
的末尾添加一個「功能」數組,其名稱不正確「別名」一個同事。所以以前定義的一切都失去了。
你正在使用哪個版本的laravel? –
你可以在'routes \ api.php'中顯示代碼嗎? – Jerodev
你修改了'config/app.php'嗎?刪除了App \ Providers \ RouteServiceProvider :: class或''Route'=> Illuminate \ Support \ Facades \ Route :: class,' –