<ul>
  <LI><A href="=http://www.360buy.com/">京东商城</A> </LI>
  <LI><A href="http://www.dangdang.com">当当网</A> </LI>
  <LI><A href="http://www.vancl.com">凡客诚品</A> </LI>
</ul>
我只想删了<A href="http://www.dangdang.com">当当网</A>保留:><A href="http://www.vancl.com">凡客诚品</A>        <A href="=http://www.360buy.com/">京东商城</A>怎么写

解决方案 »

  1.   

    echo str_replace('<LI><A href="http://www.dangdang.com">当当网</A> </LI>','',$s);
      

  2.   

    能不能过滤"当当网"整个www.dangdang.com域的
      

  3.   

    <A href="http://www.dangdang.com/product.aspx?product_id=60047314">乐扣乐扣保鲜盒_当当网</A>
    <A href="http://wwww.dangdang.com/">当当网</A>只要是http://wwww.dangdang.com/的都能过滤其超链接
      

  4.   

    <ul>
      <LI><A href="=http://www.360buy.com/">京东商城</A> </LI>
      <LI><A href="http://www.dangdang.com">当当网</A> </LI>
      <LI><A href="http://www.vancl.com">凡客诚品</A> </LI>
    </ul>我只想删了<A href="http://www.dangdang.com">当当网</A>        <A href="http://www.dangdang.com/product.aspx?product_id=60047314">乐扣乐扣保鲜盒_当当网</A>
    保留:><A href="http://www.vancl.com">凡客诚品</A>  <A href="=http://www.360buy.com/">京东商城</A>
      

  5.   

    $s=<<<txt
    <ul>
      <LI><A href="=http://www.360buy.com/">京东商城</A> </LI>
      <LI><A href="http://www.dangdang.com">当当网</A> </LI>
      <LI><A href="http://www.dangdang.com/product.aspx?product_id=60047314">乐扣乐扣保鲜盒_当当网</A> </LI>
      <LI><A href="http://www.vancl.com">凡客诚品</A> </LI>
    </ul>
    txt;
    echo preg_replace('/<LI><A href=".+(?=www\.dangdang\.com)[^\"]*".+<\/LI>/im','',$s);
      

  6.   

    使了一下,可以...谢谢"jordan102"