用户在网站后台更新后,前端页面没有及时更新,需要清除缓存或修改配置文件以确保更新生效。
<?php
// 在页面头部添加清除缓存的HTTP头
header("Cache-Control: no-cache, no-store, must-revalidate");
header("Pragma: no-cache");
header("Expires: 0");
// 其他代码...
header("Cache-Control: post-check=0, pre-check=0", false);
header("Cache-Control: private", false); // HTTP/1.1
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: max-age=0"); // HTTP/1.1
?>