谢谢大家帮忙!
每次读取
$s78_showcontent=fgets(fopen("index.wml",'r+'))."该页面已经生成!";都只能读取前一行。<?php
if(file_exists("index.wml"))
 {
  $havewml=1;  //文件存在
 }
 else
 {
  $havewml=0;  //文件不存在
 }
 
if($havewml==0)
{
$url="http://c.lexun.com/carlog/index.aspx";
$s78_content=file_get_contents($url);
preg_match("/汽车车标分类(.*)中国车标<\/a>/s",$s78_content,$s78_content);
$s78_content=preg_replace("/(车标)+/","标志",$s78_content[0]);
$s78_content=str_replace("cd=0&","",$s78_content);
$s78_content=str_replace("aspx","php",$s78_content);//==========================================================================
$of = fopen("index.wml",'w+');//创建并打开wml
if($of){
 fwrite($of,$s78_content);//把执行文件的结果写入txt文件
}
fclose($of);
//==========================================================================
$s78_showcontent=$s78_content."该页面首次生成!";
}
else
{
$s78_showcontent=fgets(fopen("index.wml",'r+'))."该页面已经生成!";
}
echo $s78_showcontent;
?>