AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
我们都知道,当 APP_DEBUG = false 时,我们展示的错误页面是这样的: ![](https://box.kancloud.cn/2015-11-23_5652d182c59da.jpg) 那我们怎么来自定义这个页面呢?其实很简单,打开 app/Exceptions/Handler.php 我们来重写下这个文件 ~~~ <?php namespace App\Exceptions; use Exception; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Symfony\Component\Debug\ExceptionHandler as SymfonyDisplayer; class Handler extends ExceptionHandler { /** * * @param \Exception $e * * @return \Symfony\Component\HttpFoundation\Response */ protected function convertExceptionToResponse(Exception $e) { $debug = config('app.debug', false); if ($debug) { // 当 debug 为 true 时,返回默认的报错页面 return (new SymfonyDisplayer($debug))->createResponse($e); } return response()->view('errors.default', ['expection' => $e], 500); } } ~~~ 然后就可以在 views/errors 下新建你的 default.blade.php 文件,自定义你页面吧