laravel routing and 404 error

前端 未结 4 1445
予麋鹿
予麋鹿 2020-12-16 04:22

I want to specify that if anything entered in the url address other than existing routes (in routes.php, then show 404 page.

I know about this:

App:         


        
4条回答
  •  Happy的楠姐
    2020-12-16 04:41

    This is my approach just for displaying the error 404 with a template layout. Just add the following code to /app/start/global.php file

    App::missing(function($exception)
    {
        $layout = \View::make('layouts.error');
        $layout->content = \View::make('views.errors.404');
        return Response::make($layout, 404);
    });
    

提交回复
热议问题