没有结束分隔符'/'发现错误 [英] No ending delimiter '/' found error
本文介绍了没有结束分隔符'/'发现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我调整了一个小脚本来检查反向链接。然而,我继续收到错误
I have adjusted a small script to check backlinks. Yet I keep on getting the error
警告:preg_match()[function.preg-match]:在第17行找不到结束分隔符'/'。
Warning: preg_match() [function.preg-match]: No ending delimiter '/' found in line 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>关于\(。*?)\',$ v,$ s);
推荐答案
错误非常清楚,你没有包括尾随的 /
:
The error is very clear really, you didn't include the trailing /
:
preg_match('/<div id="resultStats">About \(.*?)\ /',$v,$s);
老实说,我怀疑你的逃脱角色是否合适。也许你的意思是 \)
?
I honestly doubt your escape characters are well placed though. Maybe you meant \)
?
这篇关于没有结束分隔符'/'发现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文