PHP头条
热点:

php 正则表达式获取网页所有网址和链接文字


php教程 正则表达式获取网页所有网址和链接文字

$url ='http://www.111cn.net';
$body=@file_get_contents($url);
preg_match_all('/href=['"]?([^'"]*)['"]?>(.*)/i',$body,$b);
$nums = array();
foreach($b[1] as $u){
  if(in_array($u,$nums)){
  continue;
  }
  $nums[]=$u;
  $title=strip_tags($u);
  echo $title."</br>";
}

www.phpzy.comtrue/php/25191.htmlTechArticlephp 正则表达式获取网页所有网址和链接文字 php教程 正则表达式获取网页所有网址和链接文字 $url ='http://www.111cn.net'; $body=@file_get_contents($url); preg_match_all('/href=[']?([^']*)[']?(.*)/i',$body,$b)...

相关文章

    暂无相关文章

PHP之友评论

今天推荐