Home > php教程 > php手册 > php 缓存设计

php 缓存设计

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 09:55:31
Original
1196 people have browsed it

//本功能主要是利用文件修改时间函数filemtime与现在时间作减法判断是否更新内容。

$cahetime=2;//设置过期时间
$cahefile="cahe.txt";//读写文本

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

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template