Working in web development sometimes you need to reload the page from source not cache, this problem accrued when we are using Self Data POST in PHP. So solve this problem in php we will define header. The header tells the browser that for each request get response from server not cache.
Checkout other tutorial of PHP Cache,
- Prevent Browser cache in PHP
- How to Cache XML file in php
- Simple Tutorial Of APC Cache PHP
- Cache-Control HTTP Headers
- How to install APC cache on Wamp
- Create Cache File Depend On File
1 2 3 4
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache");
The only catch to setting headers is that you must do so before any of the body is generated. This means that all calls to
header( ) must define at the very top of your file, even before the tag.