开发者

Unwanted caching of web page

I have a problem of web pages being cached even though I specify that it should not. Take the simple example :

<html>
<head>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equ开发者_开发百科iv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
</head>
<?php
    print date("Y/m/d H:i:s");
?>
</html>

Hitting refresh several times in my browser indicates that this page is not reloaded as the time stays the same. It will eventually refresh if I keep on hitting the refresh button in the browser. Where could this page be cached and how can I avoid it?

I'm using Apache 2.2.15, PHP 5.3.2 on openSuse 11.2, and my testing browser is Firefox 3.5.7 on the same machine.


Have you tried using the no caching headers? e.g.:

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜