0

在我的 Laravel 包中,我有以下代码:

try {
    $var_msg = "Exception example";
    throw new InvalidNameException($var_msg);
}
catch (InvalidNameException $e) {
    abort(403, $e->getMessage());
    //report($e);Exception Log
}

错误显示为 html 错误页面。但是,我想将该错误报告为糟糕的错误。

错误图像

4

1 回答 1

0

以此代码为参考。

    $whoops = new \Whoops\Run();
    $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());

    // Set Whoops as the default error and exception handler used by PHP:
    $whoops->register();

    throw new \RuntimeException("Oopsie!");
于 2019-01-23T13:16:33.980 回答