【发布时间】:2015-06-02 20:00:45
【问题描述】:
我正在尝试显示自定义错误页面而不是默认的 Laravel 5 消息:
“哎呀……好像出了点问题”
在发布之前我进行了很多搜索,我尝试了这个解决方案,它应该可以在 Laravel 5 上运行,但没有运气:https://laracasts.com/discuss/channels/laravel/change-whoops-looks-like-something-went-wrong-page
这是我在app/Exceptions/Handler.php 文件中的确切代码:
<?php namespace App\Exceptions;
use Exception;
use View;
use Bugsnag\BugsnagLaravel\BugsnagExceptionHandler as ExceptionHandler;
class Handler extends ExceptionHandler {
protected $dontReport = [
'Symfony\Component\HttpKernel\Exception\HttpException'
];
public function report(Exception $e)
{
return parent::report($e);
}
public function render($request, Exception $e)
{
return response()->view('errors.defaultError');
}
}
但是,不是显示我的自定义视图,而是显示一个空白页面。我还尝试在render() 函数中使用此代码
return "Hello, I am an error message";
但我得到相同的结果:空白页
【问题讨论】:
标签: php laravel error-handling