How to clear browser cache with php?
I came to the conclusion that, by default, php files are never EVER pulled from cache, even in mobile browsers, even if in the response there is no Cache-Control nor Expires parameter, even if i don't send POST requests and i just follow a link to the page. They are always redownloaded.
The shortcut for clearing the cache on Edge is the same as most of the other browsers: Ctrl+Shift+Del. This will take you to the Clear Browsing Data popup where you check the boxes of everything you want to delete.
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Content-Type: application/xml; charset=utf-8");
You can delete the browser cache by setting these headers:
<?php
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With