ThinkPHP如何做页面404异常

644 ℃

thinkphp中在配置文件中如何根据不同版本抛出thinkphp的404异常页面,下面web建站小编给大家简单介绍一下具体实现方法!

thinkphp 5.0

'http_exception_template'    =>  [
  // 定义404错误的重定向页面地址
  404 =>  APP_PATH.'404.html',
  // 还可以定义其它的HTTP status
  401 =>  APP_PATH.'401.html',
]

thinkphp 5.1

'http_exception_template'    =>  [
  // 定义404错误的模板文件地址
  404 =>  Env::get('app_path') . '404.html',
  // 还可以定义其它的HTTP status
  401 =>  Env::get('app_path') . '401.html',
]

thinkphp 6.0

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

PS:1、设置【APP_PATH.’404.html’】;2、app_debug 为 false。

ThinkPHP如何实现获取SQL的方法

thinkphp如何实现添加数据(批量添加数据)

thinkphp如何实现排序代码介绍

thinkphp如何清除缓存(禁止缓存)

thinkphp怎么转化时间戳(怎么删除多条数据)

标签: 404异常, thinkphp

上面是“ThinkPHP如何做页面404异常”的全面内容,想了解更多关于 后端开发 内容,请继续关注web建站教程。

当前网址:https://m.ipkd.cn/webs_4035.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

js数字滚动效果
DedeCMS Error:Tag disabled:php错误的完整处理方法
帝国cms功能之网银支付设置方法
dede织梦会员中心发布图集缩略图失败BUG解决方法
js代码运行异常如何捕获异常