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

NotFoundHttpException-异常处理未显示响应视图Laravel,laravel,laravel-5.2,Laravel,Laravel 5.2,我想处理所有不可用的路由,并将它们重定向到我的503.blade视图。i、 e每当用户输入URL时,如//localhost:8000/adbkjabd或//localhost:8000/他们喜欢的任何内容,我都想处理它们并向它们显示503视图。在我的render()函数中。它没有将我重定向到503页,仍然在同一页中显示错误 public function render($request, Exception $e) { if ($e instanceof NotFoundHttpEx

我想处理所有不可用的路由,并将它们重定向到我的
503.blade
视图。i、 e每当用户输入URL时,如
//localhost:8000/adbkjabd
//localhost:8000/他们喜欢的任何内容
,我都想处理它们并向它们显示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);
} 

我是否对此有错误的理解,或者我是否犯了任何逻辑错误

您必须在处理程序顶部将“NotFoundHttpException”定义为“Symfony\Component\HttpKernel\Exception\NotFoundHttpException”。这不起作用,我使用了Symfony\Component\HttpKernel\Exception\NotFoundHttpException‌​n作为未发现的HttpException‌​n尝试调试$e。尝试使用get_class()函数查找它的实例。代码中没有错误。您必须在处理程序顶部将“NotFoundHttpException”定义为“Symfony\Component\HttpKernel\Exception\NotFoundHttpException”。这不起作用,我使用了Symfony\Component\HttpKernel\Exception\NotFoundHttpException‌​n作为未发现的HttpException‌​n尝试调试$e。尝试使用get_class()函数查找它的实例。代码中没有错误。你已经离开去调试它了