laravel 404页面的设置

1、laravel项目的resources/views/errors/下 添加了一个404.blade.php
2、app/Exceptions/Handler.php 文件里

public function render($request, Exception $exception)
    {
        //我自己写的,跳转到404页面,测试的时候不要打开。上线成功之后在使用404页面
       /*  if ($exception) {
            return response()->view('error.' . $exception->getStatusCode(), [], $exception->getStatusCode());
        } */
        //我自己写的结束
        return parent::render($request, $exception);
    }

猜你喜欢

转载自blog.csdn.net/weixin_42597707/article/details/81871898