Prevent Browser cache in PHP

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,

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.