PHP生成静态HTML页面最简单方法示例
- php语言
- 关注:1.38W次
PHP生成静态HTML页面最简单方法来分享给大家,跟随小编去看看吧!
PHP文件名:
复制代码 代码如下:
<?php
$string = 1;
ob_start();
@readfile("templets/");
$text = ob_get_flush();
$myfile = fopen("","w");
$text = str_replace ("{counent}",$string,$text);
fwrite($myfile,$text);
ob_clean();
?>
模板文件名:templets/
复制代码 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<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></p
- 文章版权属于文章作者所有,转载请注明 https://xuezhezhai.com/jsj/php/lwz561.html