Laravel 5.7错误404处理页面位置 [英] Laravel 5.7 error 404 handling page location

查看:333
本文介绍了Laravel 5.7错误404处理页面位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Laravel 5.7中找不到错误404页面的位置,请帮忙. 这是错误页面照片: https://imgur.com/a/Fs89isK

I couldn't find the location of the error 404 page in Laravel 5.7 please help. here is the error page photo : https://imgur.com/a/Fs89isK

推荐答案

实际上,您可以在app/Exceptions/Handler.php

并设置代码如下.

use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;


class Handler extends ExceptionHandler
{
if ($this->isHttpException($exception)) {
        if ($exception instanceof NotFoundHttpException) {
            return response()->view('error_404_path', [], 404);
            // abort(404);
        }
        return $this->renderHttpException($exception);
    }
}

这篇关于Laravel 5.7错误404处理页面位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆