在新鲜的Laravel5.6安装上(APP_DEBUG=true在.env文件中),除了这种情况外,一切正常:
当使用abort(500, 'test exception');时,它会显示“哇,看起来好像出了什么问题。”页面。
当使用abort(501, 'test exception');时,它会显示异常跟踪页。
我的问题是:为什么我要得到“哇,看起来好像出了什么问题。”当异常代码在.env文件中是500和APP_DEBUG=true时?
如何在不删除vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/500.blade.php的情况下显示错误代码为500的正常异常信息/跟踪。

发布于 2018-09-26 20:39:46
正如我们所建议的,解决方案是在App\Exceptions\Handler.php中重写App\Exceptions\Handler.php函数,如下所示:
protected function renderHttpException(HttpException $e)
{
if (config('app.debug') === true) {
//this shows Laravel exception page
return $this->convertExceptionToResponse($e);
}
//continue as normal
return parent::renderHttpException($e);
}https://stackoverflow.com/questions/52451673
复制相似问题