我用以下代码写的话,只输出了一个文章页面,如何生成我数据库里面的所有数据为静态页面呢?
$fp=fopen("t.html","r");
$content=fread($fp,filesize("t.html"));
$list="";
$sql="select * from article limit 0,10 ";
$sql1=mysql_query($sql);
$rs=mysql_fetch_array($sql1);
while ($rs=mysql_fetch_array($sql1)) {
$title=$rs['title'];
$neirong=$rs['content'];
$list .=$rs['title']."<br />";
$id=$rs['id'];
}
$content =str_replace("{list}",$list,$content);
$content=str_replace("{neirong}",$neirong,$content);
$content=str_replace("{title}",$title,$content);
$filename=$id.".html";
$handle=fopen($filename,"w");
fwrite($handle,$content);
fclose($handle);