Route::get('user/profile', function() {
return 'test' })->name('profile');
但我總是得到錯誤,當我調用地址/ profile文件 如果我使用的地址/用戶/ profile中它工作得很好。NotFoundHttpException PHP Laravel 5.2
錯誤列表顯示在我的瀏覽器:
NotFoundHttpException in RouteCollection.php line 161:
in RouteCollection.php line 161
at RouteCollection->match(object(Request)) in Router.php line 821
at Router->findRoute(object(Request)) in Router.php line 691
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 136
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 103
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 54
我在哪裏錯過? 在此先感謝。
要獲得地址/配置您的路線必須路線::得到(「曲線」).... 會地址/用戶/配置文件是你已經定義這就是爲什麼一會工夫 – Adam
同樣的確切路線,你想要達到什麼目的? – Adam
是的,我只是想通了。我剛剛購買了一本新書,我認爲我們可以使用name()作爲URL來調用我們製作的別名。 – user3859812