PHP生成静态HTML页面最简单方法示例
PHP文件名:dome.php
<?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
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <metahttp-equiv="Content-Type"content="text/html;charset=UTF-8"> <title>Inserttitlehere</title> </head> <body>
</body> <tablewidth="500"border="0"cellpadding="5"cellspacing="1"align="center"bgcolor="#add3ef"> <trbgcolor="#eff3ff"> <td>用户:{counent_user} 标题:{counent_title} 发布时间:{counent_lastdate}</td> </tr> <trbgcolor="#fff"> <td>内容:{counent_content}</td> </tr> </table> </form> </html>
热门推荐
10 五一公司放假祝福语简短
11 追星女孩的祝福语简短
12 给长辈端午祝福语 简短
13 生日祝福语有诗意简短
14 团圆日祝福语简短
15 中秋商务祝福语简短最新
16 温暖文艺简短祝福语短句
17 男孩上学祝福语简短的
18 入住酒店文案祝福语简短