您的位置:首页 > 编程语言 > PHP开发

简单的PHP缓存设计

2011-11-04 13:07 344 查看
简介:这是简单的PHP缓存设计的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。

class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=355240' scrolling='no'>
<?php
//本功能主要是利用文件修改时间函数filemtime与现在时间作减法判断是否更新内容。
$cahetime=2;//设置过期时间
$cahefile="cahe.txt";//读写文本

if(file_exists($cahefile) && time()-$cahetime< filemtime($cahefile)){

echo file_get_contents($cahefile);
}
else {
file_put_contents($cahefile,date("y-m-d H:i:s",time()));
}
?>


爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具
http://biancheng.dnbcw.info/php/355240.html pageNo:2
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: