取消换行就是这个代码:
<?php
$file_content=file_get_contents("某个HTML页面文件名");//打开HTML文件(生成后的)
$file_content=str_replace("\n","",$file_content);//删除掉换行
?>

解决方案 »

  1.   

    哦,还有,应该是这样:
    <?php
    $file_content=file_get_contents("某个HTML页面文件名");//打开HTML文件(生成后的) $file_content=str_replace("\n","",$file_content);//删除掉换行,重点是这句,如果你是在生成时取消,用这个话就可以了
    file_put_contents("某个HTML页面文件名",$file_content);//写入文件
    ?>
      

  2.   

    上面那里不记得换行了,你自己修改一下(第一行注释的$file_content=str_replace("\n","",$file_content);换成一行,这个不是注释)至于空格,楼主换的是&nbsp呢?还是源代码每一行后面的空格,如果是后者“每一行后面的空格”,你可以连同取消换行那里一起写:
    <?php
    $file_contents=file("某个文件名");
    for($i=0,$end=count($file_contents)-1;$i<=$end;$i++)
    {
    $file_contents[$i]=rtrim($file_contents[$i]);//去掉空格和换行
    }
    file_put_contents("某个文件名",$file_contents);
    ?>