ThinkPHP6.x的COOKIE中总是带有:thinkphp_show_page_trace=0|0

问题描述

ThinkPHP6.x的cookie中总带:thinkphp_show_page_trace=0|0,不但容易暴露后台服务器使用了ThinkPHP,而且对于强迫症的程序员工来说总是感觉心里太不爽了。

GET http://192.168.2.11/index HTTP/1.1
Host: 192.168.2.11
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: thinkphp_show_page_trace=1|0; thinkphp_show_page_trace=0|0

产生的原因

这个是开启trace页面调试跟踪后造成的,也是说在.env文件中设置了“APP_DEBUG = true”。

APP_DEBUG = true

[APP]
DEFAULT_TIMEZONE = Asia/Shanghai

解决方案

在.env文件中设置“APP_DEBUG = false”,并且关闭浏览器,必要时可以清空一下浏览器缓存。

APP_DEBUG = false

[APP]
DEFAULT_TIMEZONE = Asia/Shanghai

这回瞬间感觉爽了许多~~!

GET http://192.168.2.11/index HTTP/1.1
Host: 192.168.2.11
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.60
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6

参考文档:https://www.thinkphp.cn/topic/39390.html

你可能感兴趣的:(Web前后端开发,ThinkPHP,php)