日期:2014-05-17 浏览次数:20445 次
<a rel="nofollow" href="http://www.csdn.net">csdn</a>
<a target="_blank" rel="nofollow" href="http://www.csdn.net">csdn</a>
<a target="_blank" rel="nofollow" href="http://www.csdn.net">csdn</a>
<a rel="nofollow" href="http://www.csdn.net" target="_blank">csdn</a>
<a href="http://www.csdn.net" target="_blank" rel="nofollow">csdn</a>
$out=strtolower(@file_get_contents(http://www.xxx.com)); if($out){ $out=str_replace("\r\n","",$out); $out=str_replace("\r","",$out); $out=str_replace("\n","",$out); $havelink=preg_match_all('/<a(.*?)href=(.*?)http://www.csdn.net(.*?)>(.*?)<\/a>/i', $out, $m); if($havelink||strstr($robots,'nofollow')){ echo "友情链接存在"; } }
$array = <<<HTML <a rel="nofollow" href="http://www.csdn.net">csdn</a> <a target="_blank" rel="nofollow" href="http://www.csdn.net">csdn</a> <a target="_blank" rel="nofollow" href="http://www.csdn.net">csdn</a> <a rel="nofollow" href="http://www.csdn.net" target="_blank">csdn</a> HTML; preg_match_all('/(<a.*href="http:\/\/www.csdn.net".*csdn<\/a>)/is', $array, $match); if (isset($match[1])) { foreach ($match[1] as $html) { if (stripos($html, 'rel="nofollow"') !== FALSE) echo 'bad!'; break; } }