用file,再用expolde,用str_replace,应该就可以了实现了。

解决方案 »

  1.   

    针对一个,可以用explode,如果是要灵活的,可能正则要好多了,手册上有连接方面的正则用法。楼主可以参考一下!
      

  2.   

    不知道为什么,截取时 结束符 <A 就能截取到, 当< 时就无法截取到?
      

  3.   

    <?php$str_find="物业名称:国美第一城<A </td>\r\n\t\t\t\t\t\t\t\t<td width=\"220\" bgColor=\"#ffffff\" height=\"24\">";echo selectExplode($str_find,"<",0);function selectExplode($aArray,$explodeV,$alevel)
    {
    if($aArray == '') return "";
    if($explodeV == '') $explodeV = ",";
    if($alevel == '') $alevel = 0;
    $RV = explode($explodeV,$aArray);
    foreach($RV as $ID => $Level)
    {
    if($ID == $alevel)
    return $Level;
    }
    return "";
    }
    ?>
    http://esf.soufun.com/newcs/cs_swhj_56399555_-1.htm此代码运行正常。但 放到网上,去获取内容时。 国美第一城<A class='style6'  这段代码中的 < 就无法找到,为什么呢?