不用这么麻烦把.你直接echo file_get_contents(4filename)就可以了。

解决方案 »

  1.   

    如果你的源文件是放在foot_links文件夹下面的话,就直接读出来就行了.你在生成的html文件,看你的图片地址是什么,是不是src='http://localhost/foot_links这里面的单引号引起的,你原来应该用的是双引号或是没有用引号吧。
      

  2.   

    $filename="http://localhost/foot_links/about.html";
    $hand_ur=fopen($filename,"rb");
    $tihunb =' src=" ';
    $tihuan1 ='src="http://localhost/foot_links';while(!feof($hand_ur)){
      $contents .= fread($hand_ur, 8129);
      }
    fclose($hand_ur);
    $contents = str_replace($tihunb,$tihuan1,$contents);
    $smarty->assign("Hcontent",htmlspecialchars(stripslashes($contents)));
    $smarty->display("chinaacc2.html");
    这样看看,没有用正则,前提是你在http://localhost/foot_links/about.html文件的图片地址用的"双引号。
      

  3.   

    貌似 不对 页面显示 Fatal error: Call to a member function assign() on a non-object in D:\Discuz!EXP\wwwroot\chinaaac\chinaac.php on line 30
      

  4.   

    smarty没有加载正确。检查smarty路径。。
      

  5.   

    我查出来哪里错了 $tihunb =' src=" '; 应该是$tihunb ='src="'; 不要加空格 再匹配的时候  也会匹配空格 还要注意字母大小写