Is there a way to disable browser cache for a single page?

感情迁移 提交于 2019-12-05 10:06:59

Add current timestamp as parameter of url, e.g.

http://server.com/index.php?timestamp=125656789

I think this tells you what you want:

http://www.thesitewizard.com/archive/phptutorial2.shtml

Look for "Preventing the Browser From Caching"

header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );

You should send the following header:

Cache-control: no-cache

in the HTTP response.

You could add these headers:

Cache-Control: no-cache

And (for backward compatibility with HTTP/1.0 clients)

Pragma: no-cache

Here's another take that isn't PHP specific.

Try this in your <head> </head> section:

<meta http-equiv="cache-control" content="no-cache, no store"/>
<meta http-equiv="Expires" Content="Mon, 25 May 2009 19:07:03 GMT">

Found that at the end of a long thread here:

http://forums.mozillazine.org/viewtopic.php?f=25&t=673135&start=75

Use the header() function. You have to set a few to cover all browsers; see http://www.php.net/manual/en/function.header.php#75507

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!