2

I am using this code to disable cache in php but this code is not working on any browser. Please somebody help me, I don't want to save php web page in cache memory

header('cache-control: no-cache,no-store,must-revalidate'); 
header('pragma: no-cache'); 
header('expires: 0');
StarsSky
  • 6,721
  • 6
  • 38
  • 63
user3315933
  • 21
  • 1
  • 2
  • 1
    see [How to disable caching](http://stackoverflow.com/questions/404617/disabling-the-browser-cache-in-php-or-using-javascript) – ponciste Feb 16 '14 at 12:56

1 Answers1

3
header("Expires: Tue, 03 Jul 2001 06:00:00 GMT"); // *
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
  • If the 0 in the header expires isn't working on expires due to old browsers not understanding it, you can try putting the date to a time in the past.
Simone Nigro
  • 4,717
  • 2
  • 37
  • 72