【发布时间】:2014-07-21 11:31:44
【问题描述】:
我正在编写一个脚本来修改它自己的内容,我很难阻止它缓存自身并且不显示更新的页面......
我已经尝试了所有我能想到的... 我在 PHP 代码中添加了这些标头:
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
header('Expires: 0'); // Proxies.
我在 HTML 代码中添加了这些元标记:
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
我什至在其中添加了一个 .htaccess 文件:
Options -Indexes
<IfModule mod_headers.c>
Header set Cache-Control "no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires 0
</IfModule>
...然而浏览器一直在缓存它...我还能做些什么吗?
谢谢
【问题讨论】:
-
您能显示包含脚本的位置的 sn-p 吗?它是如何自我改造的?
-
在一天结束的时候,浏览器可能会做它想做的任何事情——不管你告诉它做什么。