我调整了一个小脚本来检查反向链接。但我仍然收到错误
警告:preg_match() [function.preg-match]:第 17 行未找到结束分隔符“/”。
<?php
function file_get_contents_curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
function google_backlink($uri)
{
$url = 'http://www.google.com/search?q=link:facebook.com&hl=en&filter=0';
$v = file_get_contents_curl($url);
preg_match('/<div id="resultStats">About \(.*?)\ ',$v,$s);
$s_number = explode(".", $s[1]);
$i = 0;
if ($s[1]!=0) {
return $s[1];
} else {
return ($r[1]) ? $r[1] : '0';
}
}
echo "Google backlink = ".google_backlink($url)."<br />";
?>
出什么问题了preg_match('/<div id="resultStats">About \(.*?)\ ',$v,$s);
该错误确实非常明显,您没有包含尾随/
:
preg_match('/<div id="resultStats">About \(.*?)\ /',$v,$s);
老实说,我怀疑你的逃脱角色是否放置得很好。也许你的意思是\)
?
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)