PHP动态页面 生产静态页 方法一
2012-07-02 09:18
295 查看
PHP文件名:dome.php
模板文件名:templets/list.html
运行dome.php,自动在当前目录下生产list.html
<?php $string = 1; ob_start(); @readfile("templets/list.html"); $text = ob_get_flush(); $myfile = fopen("list.html","w"); $text = str_replace ("{counent}",$string,$text); fwrite($myfile,$text); ob_clean(); ?>
模板文件名:templets/list.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> </body> <table width="500" border="0" cellpadding="5" cellspacing="1" align="center" bgcolor="#add3ef"> <tr bgcolor="#eff3ff"> <td>用户:{counent_user} 标题:{counent_title} 发布时间:{counent_lastdate}</td> </tr> <tr bgcolor="#fff"> <td>内容:{counent_content}</td> </tr> </table> </form> </html>
运行dome.php,自动在当前目录下生产list.html
相关文章推荐
- PHP动态页面 生产静态页 方法二
- php使用QueryList轻松采集js动态渲染页面方法
- 在PHP动态网页中实现支持页面回跳的方法
- php的动态页面在ie内核的浏览器下面整体偏左的解决方法
- php读取动态页面生成静态html文件的方法
- Nginx PHP5(FastCGI)生产环境跑PHP动态程序可超过“700次请求/秒”
- jQuery提交数据给php,serialize()方法提交所有数据,不发生页面跳转
- PHP -- 页面传值的6种获取方法
- PHP生成静态HTML页面简单方法
- PHP动态生成指定大小随机图片的方法
- php 自动更新时间(在页面动态显示时间)
- php页面防重复提交方法总结
- (转载)向页面某处动态添加js的方法
- PHP中静态页处理动态内容的思路
- php页面静态化的方法(新手笔记)
- 一个简单的动态页面转静页面的方法
- struts2的XML配置、动态方法调用、获取页面表单元素的方法
- php实现页面跳转的方法
- php实现页面跳转的三种方法
- PHP 页面跳转到另一个页面的几种方法分享