对于一个小型 Intranet 站点,我有一个被 Firefox 错误缓存的动态(包括 AJAX)页面。有没有办法禁用单个页面的浏览器缓存?
这是我正在使用的设置:
- XAMPP下的Apache,运行在Windows服务器上
- PHP
澄清
我主要关心的内容是页面文本和一些<select>
s中的默认选项。因此,例如,我不能只在某些图像 URL 的末尾添加随机数。
更新:
我遵循了迄今为止得到的建议:
- 我正在发送 nocache 标头(见下文)
如果页面在 2 秒后重新加载,我将包含时间戳 URL 参数并重定向到新参数,如下所示:
$timestamp = $_GET['timestamp']; if ((time()-$timestamp) > 2) { header('Location:/intranet/admin/manage_skus.php?timestamp='.time()); }
现在 Firebug 显示标头没有指定缓存,但问题仍然存在。以下是页面的响应标头:
Date Fri, 25 Sep 2009 20:41:43 GMT
Server Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.8
X-Powered-By PHP/5.2.8
Expires Mon, 20 Dec 1998 01:00:00 GMT
Last-Modified Fri, 25 Sep 2009 20:41:43 GMT
Cache-Control no-cache, must-revalidate
Pragma no-cache
Keep-Alive timeout=5, max=100
Connection Keep-Alive
Transfer-Encoding chunked
Content-Type text/html