代码如下 | 复制代码 |
preg_match_all("/<a(.*?)href=(.*?)</a>/i",$webContent,$link); $urls =array(); foreach($link[0] as $value) { if(strstr($value,'http') ) { if(strstr($value, $ex[3]) || strstr( $value,$ex[0]) || strstr($value,$ex[1]) || strstr($value,$ex[2])) { continue; } else { preg_match_all("/hrefs*=s*(['"]?)(.*?)\1/is", $value, $vlink); $urls[] = $vlink[2]; } } } $strUrl = deleteEmptyArray( $urls); function deleteEmptyArray( $val ) |
时间: 2024-09-28 20:15:02