laravel5配置filp/whoops报错提示插件

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

有问题可在下面发表评论,当然没事也可以在下面吹吹牛皮、扯扯淡!

发表评论

*


Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/blog/content/templates/Bitter/footer.php:40) in /www/wwwroot/blog/include/lib/view.php on line 23