<p>&nbsp;</p><p><img hspace="0" src="../../../images/stories/p1010034.jpg" border="0" /></p><p>——访RFID产品市场工程师 杨军良</p><p>&#160;&#160;&#160; 在这次展会上ST特意展示了它的新产品市场上第一款电机和电源管理用户定制化混合信号芯片。RFID产品市场工程师 杨军良为我们做了详细介绍。</p><p>&#160;&#160;&#160; 2007年5月9日 — 意法半导体(纽约证券交)以上是记录里的数据,怎样才能把里面的html代码还有&#160掉

解决方案 »

  1.   

    用正则表达式过滤吧。<(.[^>]*)>
      

  2.   

    strip_tags()
    用这个函数可以直接去掉html及php的标签,比正则方便
      

  3.   

    <?phpclass _GETCHAR{ var $sStr = "";
    var $sTmp = ""; function __construct(){
    //NULL
    } function FileGetContents($url){
    $fp = @fopen($url,"r");
    while(!feof($fp)){
    $this -> sTmp .= fgets($fp);
    }
    $this -> sTmp = $this -> DelHtml($this -> sTmp);
    return $this -> sTmp;
    } function DelHtml($str){ $search = array ("'<script[^>]*?>.*?<\/script>'si",  // 去掉 javascript
     "'<iframe[^>]*?>.*?<\/iframe>'si", //去掉iframe
     "'<style[^>]*?>.*?<\/style>'si", //去掉CSS
     "'<[\/\!]*?[^<>]*?>'si",           // 去掉 HTML 标记
     "'([\r\n])[\s]+'",                 // 去掉空白字符
     "'&(quot|#34);'i",                 // 替换 HTML 实体
     "'&(amp|#38);'i",
     "'&(lt|#60);'i",
     "'&(gt|#62);'i",
     "'&(nbsp|#160);'i",
     "'&(iexcl|#161);'i",
     "'&(cent|#162);'i",
     "'&(pound|#163);'i",
     "'&(copy|#169);'i",
     "'&#(\d+);'e"); $replace = array ("",
      "",
      "",
      "",
      "\\1",
      "\"",
      "&",
      "<",
      ">",
      " ",
      chr(161),
      chr(162),
      chr(163),
      chr(169),
      "chr(\\1)");
    return preg_replace($search, $replace, $str); }}$o = new _GETCHAR();
    $str = $o -> FileGetContents("http://www.sohu.com");
    echo $str;?>
      

  4.   

    正规倒是王道,不过这里strip_tags()多简单啊