Wednesday, February 8, 2012

Prevent Browser cache PHP

Working with PHP in some times we need to avoid browser cache, Browser cache will cases you to prevent page updates when ever we work on Self Data POST in PHP,

Here I give the solution to prevent the Browser cache when reloading current page. and re-download the actual page with dynamic content.
header( "Last-Modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" );
header( "Expires: " . gmdate( "D, j M Y H:i:s", time() ) . " GMT" );
header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1
header( "Cache-Control: post-check=0, pre-check=0", FALSE );
header( "Pragma: no-cache" ); // HTTP/1.0

1 comment:

  1. This is an awesome post. Really very informative and creative contents. This concept is a good way to enhance the knowledge. I like it and help me to development very well. Thank you for this brief explanation and very nice information. Well, got a good knowledge.
    SEO Course in Chennai