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

laravel 5.0 版本下,修改pp/Exceptions/Handler.php
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); }

修改下面文件

resources/views/errors/404.blade.php

参考:
官网评论
posted @ 2017-05-26 16:34  水飝飞天  阅读(3258)  评论(0编辑  收藏  举报