php判断来访蜘蛛的信息的函数,具体代码如下:
function get_naps_bot(){ $useragent=strtolower($_SERVER['HTTP_USER_AGENT']); if(strpos($useragent,'googlebot')!==false){ return 'Googlebot'; } if(strpos($useragent,'msnbot')!==false){ return 'MSNbot'; } if(strpos($useragent,'slurp')!==false){ return 'Yahoobot'; } if(strpos($useragent,'baiduspider')!==false){ return 'Baiduspider'; } if(strpos($useragent,'sohu-search')!==false){ return 'Sohubot'; } if(strpos($useragent,'lycos')!==false){ return 'Lycos'; } if(strpos($useragent,'robozilla')!==false){ return 'Robozilla'; } return false; }