NotFoundHttpException - 异常处理未显示响应视图Laravel

时间:2017-02-05 06:35:49

标签: laravel laravel-5.2

我想处理所有不可用的路由,并将它们重定向到我的503.blade视图。即每当用户输入//localhost:8000/adbkjabd//localhost:8000/anything-they-like之类的网址时,我想处理它们并向其显示503视图。在我的render()函数中。它没有将我重定向到503页面,仍然在同一页面中说错误。

public function render($request, Exception $e)
{

    if ($e instanceof NotFoundHttpException) {

        // normal 503 view page feedback
        return response()->view('errors.503', [], 404);
    }

    return parent::render($request, $e);
} 

我对此有错误的理解,还是我犯了任何逻辑错误?

0 个答案:

没有答案