搜索
博主信息
博文 20
粉丝 0
评论 0
访问量 23362
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
生成静态页面
大鱼
原创
1051人浏览过

1,准备要生成静态页面的php如index.php

2,将其 加载页面代码复制 然后保存至新建 include_zhaobiao_index.php

3,准备生成静态文件的php (最好建立文件夹 如:makeStatic 放在项目的根目录里)可起文件名为 make_zhaobiao_index.php 文件内容 (如下) 准备生成静态文件目录(如:staticZhongxinHtml),注意:最好文件夹在项目根目录 这样比较快

<?php
set_time_limit(30) ;
include_once '../php/config1.php';
//原home.php 文件的主程序
include_once SMARTY_PATH.'new_site/zhao_biao/zhong_xin/include_zhaobiao_index.php';
$output = $smarty->fetch ("new_site/zhao_biao/zhong_xin/index.html");//smarty加载html
file_put_contents(SMARTY_PATH.'../staticZhongxinHtml/zhaobiao_index.html', $output);//写入相应文件夹及文件(自定义)
?>

4,运行 make_zhaobiao_index.php 看看 文件夹 staticZhongxinHtml 是否顺利生成 zhaobiao_index.html 。

5,成功则把原始的 index.php 改为

echo  file_get_contents(SMARTY_PATH."../staticZhongxinHtml/zhaobiao_index.html");

6,然后加上后台自动运行文件 每隔15秒 生成一次静态文件

本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学