關(guān)于“php_正則匹配_-”的問題,小編就整理了【1】個(gè)相關(guān)介紹“php_正則匹配_-”的解答:
php信息申請代碼?$url="";
//獲取頁面代碼
$rs=file_get_contents($url);
//設(shè)置匹配正則
//$fp=fopen("text.txt","a");
//$fw=fwrite($fp,$rs);
//fclose($fp);
/*<I class=titles><A
href=""
target=_blank>留住你身邊的好男人</A></I>*/
$preg='/<i\s+class=\"titles\"><a\s+href=\"[^>]+\">(.*)<\/a><\/i>/i';
//進(jìn)行正則搜索
preg_match_all($preg,$rs,$title);
//計(jì)算標(biāo)題數(shù)量
$count=count($title[0]);
echo $count."<br>";
//通過標(biāo)題數(shù)量進(jìn)行內(nèi)容采集
到此,以上就是小編對于“php_正則匹配_-”的問題就介紹到這了,希望介紹關(guān)于“php_正則匹配_-”的【1】點(diǎn)解答對大家有用。