Home  >  Q&A  >  body text

Clear website browser cache using PHP

Try clearing the browser site cache in php,

The firefox browser works fine, as we would like, but when I run it in chrome it doesn't work. See code,


header('Clear-Site-Data: "cache", "cookies", "storage", "executionContexts"'); //Firefox
 
 // Crome
 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
 header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");  
 header ("Cache-Control: no-cache, must-revalidate");  
 header ("Pragma: no-cache");
 header('Clear-Site-Data: "cookies"');
                
 return $this->getSuccessResponse("Token Valid");

P粉015402013P粉015402013229 days ago363

reply all(1)I'll reply

  • P粉381463780

    P粉3814637802024-03-28 10:52:37

    I don't think you can perfectly clear the cache from your browser, the only option is that you can do it manually. There is some code. I hope it will work.

    reply
    0
  • Cancelreply