服务器测评网
我们一直在努力
广告
广告
广告
广告
广告
广告
广告
广告
广告

thinkphp6、thinkphp8 自定义异常显示页面

广告
广告

进入 config/app.php 里面,增加下面的信息

 // 异常页面的模板文件
    'exception_tmpl'   => app()->isDebug()==true ?
                          app()->getThinkPath() . 'tpl/think_exception.tpl' :
                          \think\facade\App::getAppPath() . 'error.html',

    'http_exception_template' => [
        // 定义404错误的模板文件地址
        404 => \think\facade\App::getAppPath() . '404.html',
        // 还可以定义其它的HTTP status
        500 => \think\facade\App::getAppPath() . '500.html',
    ],

 

我本人的代码是:

 // 异常页面的模板文件
    'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',

    //指定404页面
    'http_exception_template' => [
        404 => app()->getRootPath() . '/view/index/404.html', // 指定404错误的模板文件
        // 可以继续添加其他HTTP状态码和模板
    ],

 

好主机测评广告位招租-300元/3月
赞(0) 打赏
未经允许不得转载:好主机测评网 » thinkphp6、thinkphp8 自定义异常显示页面
好主机测评广告位招租-200元/3月
好主机测评广告位招租-100元/3月

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续提供更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫

微信扫一扫