PHP 程式碼:(清cache)
header("Expires: Mon, 26 Jul 1990 05:00:00 GMT");
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");
HTML 程式碼:(重新整理)
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="0">
註1:時間可以自己改PS.
如果是用<script src="my.js"></script>這種方式引入,可以調整為
<script src="my.js?v=<?=md5(time())?>"></script>
利用PHP的md5產生亂數來讓瀏覽器重新讀取js檔
<script src="my.js?v=<?=md5(time())?>"></script>
利用PHP的md5產生亂數來讓瀏覽器重新讀取js檔
No comments:
Post a Comment