PHP - キャッシュを無効化する
以下のコードにより”ほぼ”強制的にキャッシュを無効にできます
<?php
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-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>
.htaccessの場合
<Files ~ "\.(html|php)$">
Header add Pragma "no-cache"
Header set Cache-Control no-cache
</Files>
※Apacheにmod_headerモジュールが必要
<?php
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-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>
.htaccessの場合
<Files ~ "\.(html|php)$">
Header add Pragma "no-cache"
Header set Cache-Control no-cache
</Files>
※Apacheにmod_headerモジュールが必要
2006年06月13日(火) 13:59:21 Modified by chando