我认为Apache会将这些HTTP标头添加到PHP脚本生成的所有响应中:
Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
这适用于实际的动态页面,但我有一些页面,虽然由PHP生成,但大部分是静态的,我希望浏览器缓存它们.
PHP中是否有一种方法可以从响应中删除这些标题,从而激活浏览器的默认缓存规则,如果没有,是否有任何值可以将它们设置为等同于它们不存在?
我宁愿不设置自己的值,因为我希望浏览器使用与Apache本身提供的静态资源相同的缓存规则(不使用mod_cache).
大家好,我遇到了 http 标头请求的问题,当我测试标头时,我得到了这个响应
HTTP/1.1 200 OK
Date: Sat, 29 Oct 2016 14:24:31 GMT
Server: Apache
X-Powered-By: PHP/5.6.27
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=2d17992cfbd621c51eca940df478b89a; path=/
Vary: Accept-Encoding,User-Agent
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Security-Policy: allow 'self';
X-Content-Type-Options: nosniff
Cache-Control: max-age=604800, must-revalidate
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
Content-Language: it-it
Run Code Online (Sandbox Code Playgroud)
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
check=0
Pragma: no-cache
Run Code Online (Sandbox Code Playgroud)
HTTP/1.1 200 OK …Run Code Online (Sandbox Code Playgroud)