怎么保存 html静态页面,静态页面怎么实现,就是把数据写入到html页面在缓存起来?...

 2023-09-09 阅读 18 评论 0

摘要:static.php 文件$file = "static.html";$ctime =filectime($file);怎么将网页以html保存到文件夹中,$expr = 3600*24*10;//静态文件有效期,十天if(file_exists($file)) {if($ctime+$expr> time()){echo file_get_contents($file);htmlcss制

static.php 文件

$file = "static.html";

$ctime =filectime($file);

怎么将网页以html保存到文件夹中,$expr = 3600*24*10;//静态文件有效期,十天

if(file_exists($file)) {

if($ctime+$expr> time()){

echo file_get_contents($file);

htmlcss制作?}else{

unlink($file);//删除过期的静态页文件

ob_start();

//从数据库取出数据写入 static.html

js写入html。$content = ob_get_contents();

file_put_contents($file,$content);//写入内容到对应静态文件中

ob_end_flush();

}

htmlcss静态页面及代码?}else{

ob_start();

//从数据库取出数据写入 static.html

$content = ob_get_contents();

js写入本地文件。file_put_contents($file,$content);//写入内容到对应静态文件中

ob_end_flush();

}

?>

html+css、static.html 页面

静态页面

数据库的数据1

数据库的数据2

数据库的数据3

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/2/25489.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息