laravel 处理自定错误页面,如404,500,501,502,503,504等等

laravel 5.0 版本下,
public function render($request, Exception $e) { if ($e instanceof ModelNotFoundException) { $e = new NotFoundHttpException($e->getMessage(), $e); } if($e instanceof \Symfony\Component\Debug\Exception\FatalErrorException && !config('app.debug')) {  //加上app.debug判断是怕dubug关闭模式下暴露重要信息 return response()->view('errors.default', [], 500); //default换成你自定义的页面 } return parent::render($request, $e); }

修改下面文件

修改pp/Exceptions/Handler.phpresources/views/errors/404.blade.php

参考:
官网评论
相关文章
相关标签/搜索