1) composer.json中增加扩展 "require":{ "filp/whoops":"*", }, 2)命令行执行 composer update 3)命令行执行 composer dump-autoload 4)监控错误信息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;
Comments : 0