如果找不到路線,我想顯示索引頁。我已經像這樣修改了 App\Exceptions\Handler 但不起作用public function render($request, Exception $exception){ if ($this->isHttpException($exception) || $exception instanceof UnauthorizedException) { if ($exception->getStatusCode() == 404) { return view('app.index'); } } return parent::render($request, $exception);}
1 回答

繁星coding
TA貢獻1797條經驗 獲得超4個贊
這是我的錯誤,我可以通過將所有請求植根到索引來完成同樣的事情。
Route::get('/{any}', 'FrontEndController@index')->where('any', '.*');
- 1 回答
- 0 關注
- 112 瀏覽
添加回答
舉報
0/150
提交
取消