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
<!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>
相关文章
使用laravel的Eloquent模型如何获取数据库的指定列
今天小编就为大家分享一篇使用laravel的Eloquent模型如何获取数据库的指定列,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧2019-10-10Kindeditor编辑器添加图片上传水印功能(php代码)
这篇文章主要为大家详细介绍了Kindeditor编辑器加图片上传水印功能,具有一定的参考价值,感兴趣的小伙伴们可以参考一下2017-08-08
最新评论