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

更新时间:2016-06-11    来源:正则表达式    手机版     字体:

【www.bbyears.com--正则表达式】

$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."
";
}

本文来源:http://www.bbyears.com/aspjiaocheng/24537.html

猜你感兴趣

热门标签

更多>>

本类排行