欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP生成靜態(tài)HTML頁面最簡單方法示例

 更新時間:2015年04月09日 08:51:35   投稿:junjie  
這篇文章主要介紹了PHP生成靜態(tài)HTML頁面最簡單方法示例,本文使用模板替換的方法生成HTML頁面,是最通用的方法,需要的朋友可以參考下

PHP文件名:dome.php

復(fù)制代碼 代碼如下:

<?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
復(fù)制代碼 代碼如下:

<!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}  標(biāo)題:{counent_title}  發(fā)布時間:{counent_lastdate}</td>
  </tr>
  <tr bgcolor="#fff">
    <td>內(nèi)容:{counent_content}</td>
  </tr>
</table>
</form>
</html>

相關(guān)文章

最新評論