我使用密码调子,如果在内容上有色谱,则想要检查,那么返回确实是假的。
例如,希望打字,以便:http://chat.stackoverflow.com/。 页: 1
我尝试的是,它有错误:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, http://stackoverflow.com/ );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec($ch);
curl_close($ch);
$link="http://chat.stackoverflow.com/";
if(preg_match($link,$contents) && stripos($contents,"chat.stackoverflow")){
echo "yes";
}else{
echo "no";
}
?>
产出如下:
Warning: preg_match(): Delimiter must not be alphanumeric or backslash in /code/O4savv on line 8
no
Demo:http://codepad.viper-7.com/O4savv”rel=“nofollow” http://codepad.viper-7.com/O4savv
如何解决这一问题?