...

View Full Version : No Cache



mr_ego
10-22-2003, 10:27 AM
How do you stop PHP from allowing the browser to keep the file as a cache. You do this in the header somehow. PHP.NET doesnt go into it. I couldn't find anything..


header( ...? );

maltrecho
10-22-2003, 01:33 PM
This is what I use. I found it somewhere in php.net.


<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Pragma: no-cache");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
?>

raf
10-22-2003, 01:36 PM
You found it here

http://be.php.net/header

:D

maltrecho
10-22-2003, 04:16 PM
Actually the page I took it from was "php.net/header_SOMETHING" (don't remember) but it must have changed since I cannot find it anymore. In the page you're refering to, header("Cache-Control: post-check=0, pre-check=0", false); is missing. Who cares! that's not a big deal. From Belgium, uh? :thumbsup:

raf
10-22-2003, 07:33 PM
Originally posted by maltrecho
In the page you're refering to, header("Cache-Control: post-check=0, pre-check=0", false); is missing. Who cares! that's not a big deal. From Belgium, uh? :thumbsup:
Missing? I see it tree times there. (once in the actual manual and in 2 posts)


<?php
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);

// HTTP/1.0
header("Pragma: no-cache");
?>

But i agree it probably doesn't make much difference. You cant safely prevent clientside caching, since some browsers can ignore caching instructions.

Belgium, indeed. The rouring mouse !



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum