このコードの使用:
<?php
// Define path and name of cached file
$cachefile = 'cache/'.date('M-d-Y').'.php';
// How long to keep cache file?
$cachetime = 18000;
// Is cache file still fresh? If so, serve it.
if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) {
include($cachefile);
exit;
}
// if no file or too old, render and capture HTML page.
ob_start();
?>
<html>
Webpage content in here
</html>
<?php
// Save the cached content to a file
$fp = fopen($cachefile, 'w');
fwrite($fp, ob_get_contents());
fclose($fp);
// Send browser output
ob_end_flush();
?>
ページの DIV タグをキャッシュから除外する方法はありますか? 毎日更新される価格表を除いて完全にキャッシュできるページがあり、その DIV がキャッシュされないようにしたいと考えていました。
ありがとう :)