Pages being cached wno matter what i tried. As a result php functions run once and after that show the cached result always until you hit Shift+F5
I disabled Opcache (no opcache anymore on phpinfo())
I disabled APC (no APC anymore on phpinfo())
I used headers
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Pragma: no-cache"); // HTTP/1.0 header("Last-Modified: ". gmdate("D, d MYH:i:s"). " GMT");
I added at apache2/000-default-conf
Header set Cache-Control "max-age=0, public"
I added at .htaccess
RewriteEngine On <FilesMatch ".(html|htm|js|css)$"> FileETag None Header unset ETag Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" Header set Pragma "no-cache" Header set Expires "Wed, 12 Jan 1980 05:00:00 GMT"
No more solutions come to mind.
Anyone happens to know what is going on? Many thanks in advance
These lines of code should make cache expire immediately in PHP:
header("Content-Type: application/json");
header("Expires: 0");
or use:
header("Expires: on, 01 Jan 1970 00:00:00 GMT"); //--> for old browsers
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 technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.