使用此代码:
<?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 被缓存
谢谢 :)