源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

PHP生成静态HTML页面最简单方法示例

  • 时间:2020-03-08 11:45 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:PHP生成静态HTML页面最简单方法示例
PHP文件名:dome.php
[u]复制代码[/u] 代码如下:
<?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
[u]复制代码[/u] 代码如下:
<!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>
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部