Blogger Information
Blog 20
fans 0
comment 0
visits 19586
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
生成静态页面
大鱼
Original
854 people have browsed it

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秒 生成一次静态文件

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post