Home >Backend Development >PHP Tutorial >php判断来访蜘蛛信息的函数

php判断来访蜘蛛信息的函数

WBOY
WBOYOriginal
2016-06-20 13:02:231251browse

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 />}


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn