代码如下:
<?
$name=$_POST['name'];
$title=$_POST['title'];
$textarea=$_POST['textarea'];
$conn=mysql_connect("localhost","root","1212923456");
mysql_select_db("test",$conn);
$sql="insert into news(id,name,title,textarea) values ('','$name','$title','$textarea')";
mysql_query("SET NAMES 'gbk'");
mysql_query($sql);
$sql="select * from news";
$result=mysql_query($sql);
echo "增加新闻的显示内容如下.<br>";
while($row=mysql_fetch_array($result)){  $temp="temp.html";
  $file=fopen($temp,"rb");
  $contents=fread($file,filesize($temp));
  $contents=str_replace("{title}",$row[title],$contents);
  $contents=str_replace("{boby}",$row[textarea],$contents);
  fclose($file);
  $html="$row[id].html";
  $files=@fopen($html,"wb");
  fwrite($files,$contents);
  fclose($files);
   
  echo "<a href=\"$row[id].html\" target='_blank'>$row[title]</a>.<br>";   }
   
 ?>
如果我删除了数据库里id为1的记录就会把生成的1.html页面也删除了录删 可是文件夹里还有1.html这个页面如何在删除记录的时候也把生成的面页也给删了