Prevent page caching in php using header() function

Last updated 2 years, 7 months ago | 332 views 75     5

Tags:- PHP

PHP | header() function

By sending the headers bellow, we change the browser’s default cache settings. We can override any of those settings and force the browser to not cache. In this code we just have to set date in the past.

<?php
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
?>

<html>
<body>

...
...