$userAgent=strtolower($_SERVER['HTTP_USER_AGENT']);
$spiders=array(
‘Googlebot',//Google爬虫
‘Baiduspider',//百度爬虫
‘Yahoo!Slurp',//雅虎爬虫
‘YodaoBot',//有道爬虫
‘msnbot'//Bing爬虫
//更多爬虫关键字
);
foreach($spidersas$spider){
$spider=strtolower($spider);
if(strpos($userAgent,$spider)!==false){
returntrue;
}
returnfalse;