在php中自动刷新缓存系统生成的页面html
所以我刚刚发现了在php中建立系统缓存,但我需要了解一件事。我有一个在php中自动刷新缓存系统生成的页面html,php,html,caching,Php,Html,Caching,所以我刚刚发现了在php中建立系统缓存,但我需要了解一件事。我有一个index.php文件,我包括了这个文件,它有两个文件cache top.php和cache bottom.php,我生成了一个index.html文件,我还将index.php中的文件名更改为first.php,以便在你进入网站时落在index.html页面上。系统运行良好,因为我有一个生成的文件,但我觉得index.html文件在2分钟后不会更改,因为我在“cache-top”文件中配置了刷新index.html的内容。ht
index.php
文件,我包括了这个文件,它有两个文件cache top.php
和cache bottom.php
,我生成了一个index.html
文件,我还将index.php
中的文件名更改为first.php
,以便在你进入网站时落在index.html
页面上。系统运行良好,因为我有一个生成的文件,但我觉得index.html文件在2分钟后不会更改,因为我在“cache-top”文件中配置了刷新index.html的内容。html
必须先刷新页面first.php
,想知道这是否正常?对于index.html
文件,有什么解决方案可以刷新其内容而不刷新first.php
cache-top.php代码:
$expireTime = time () -120 ;
$caching = FALSE ;
$cacheFile = "index.html";
If( file_exists($cacheFile) ) {
if (filemtime($cacheFile) < $expireTime) {
ob_start();
} else {
$caching = TRUE ;
readfile($cacheFile);
}
} else {
ob_start() ;
}
$expireTime=time()-120;
$caching=FALSE;
$cacheFile=“index.html”;
如果(文件_存在($cacheFile)){
if(filemtime($cacheFile)<$expireTime){
ob_start();
}否则{
$caching=TRUE;
readfile($cacheFile);
}
}否则{
ob_start();
}
先谢谢你