我动态生成了二排14个小图的列表
//////////////////////////////////////////////
现在要生成html的,我只会写生成一行html的的语句
<?php
$link=mysql_connect("localhost","admin","weiweike") or die("数据库忙");
mysql_select_db("movie") or die("用户表忙");
$result=mysql_query("SELECT * FROM m_index ORDER BY 'id' DESC LIMIT 0,7");
while($r=mysql_fetch_array($result))
{
$list.='
'.$r["mname"].'
';
}
$fp = fopen ("temp.html","r");
$content = fread ($fp,filesize ("temp.html"));
$content= str_replace ("{pic}",$list,$content);
$filename= "test.html";
$handle=fopen($filename,"w"); //打开文件指针,创建文件
if (!is_writable($filename)){
die ("文件:".$filename."不可写,请检查其属性后重试!");
}
if (!fwrite ($handle,$content)){ //将信息写入文件
die ("生成文件".$filename."失败!");
}
fclose ($handle); //关闭指针
die ("创建文件".$filename."成功!");
?>
temp.html