好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

php获取指定位置内容 - php函数

php获取指定位置内容

这款函数比较实用于数据采集,一般采集数据时会要指定一个区域的内容,这个代码就可以实例:

$str = "<!-- fdaf-- -->" ;  echo  strip_comments(  $str  );    function  strip_comments( $data ) {       $the_rest  =  $data ;       $result  =  "" ;         while  ( $the_rest ) {           $start  =  strpos ( $the_rest ,  "<!--" );           if  ( $start  === false) {               $result  .=  $the_rest ;               break ;          }             $result  .=  substr ( $the_rest , 0,  $start );             $end  =  strpos ( $the_rest ,  "-->" ,  $start );           if  ( $end  === false) {               break ;          }             $the_rest  =  substr ( $the_rest ,  $end +3);      }         return   $result ;  } 

查看更多关于php获取指定位置内容 - php函数的详细内容...

  阅读:43次