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