0

I added code into my website pages for browser cache control on live server. But I didn't get any response from my browser. Every time load my page from the browser cache.

Please, Anybody, help me?


$ts = gmdate("D, d M Y H:i:s") . " GMT";
header("Expires: $ts");
header("Last-Modified: $ts");
header("Pragma: no-cache");
header("Cache-Control: no-store");
header('Cache-Control: max-age=30000');

$file_last_mod_time = filemtime(__FILE__);

$content_last_mod_time = 1520949851;

$etag = '"' . $file_last_mod_time . '.' . $content_last_mod_time . '"';

header('Cache-Control: max-age=86400');

header('ETag: ' . $etag);

if(isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
    if($_SERVER['HTTP_IF_NONE_MATCH'] == $etag) {
        header('HTTP/1.1 304 Not Modified', true, 304);
        exit();
    }
}
Usman Maqbool
  • 3,351
  • 10
  • 31
  • 48

1 Answers1

0

The same thing happened with me and I solved it by using this method. Create a file called clear.php, Paste the following code and Run.

<?php
opcache_reset();
?>
Samir Patel
  • 167
  • 1
  • 7