laravel5配置filp/whoops报错提示插件
2018-06-17
后端
1) composer.json中增加扩展"require":{"filp/whoops":"*",},2)命令行执行 composer update3)命令行执行 composer dump-autoload4)监控错误信息appExceptionsHandler.php注释原来的render方法增加:/** * Render an exception into an HTTP response. * * @param IlluminateHttpRequest $request * @param Exception $e * @return IlluminateHttpResponse */publicfunction render($request,Exception $e){if($this->isHttpException($e)){return $this->renderHttpException($e);}if(config('app.debug')){return $this->renderExceptionWithWhoops($e);}return parent::render($request, $e);}/** * Render an exception using Whoops. * * @param Exception $e * @return IlluminateHttpResponse */protectedfunction renderExceptionWithWhoops(Exception $e){ $whoops =new WhoopsRun; $whoops->pushHandler(new WhoopsHandlerPrettyPageHandler());returnnew IlluminateHttpResponse( $whoops->handleException($e), $e->getStatusCode(), $e->getHeaders());}5)代码中测试报错: var_dump($a);die;