Home >Backend Development >PHP Tutorial >请教$_SERVER['HTTP_USER_AGENT']能否发现百度蜘蛛

请教$_SERVER['HTTP_USER_AGENT']能否发现百度蜘蛛

WBOY
WBOYOriginal
2016-06-13 10:26:551035browse

请问$_SERVER['HTTP_USER_AGENT']能否发现百度蜘蛛?
我做了个网站想统计百度蜘蛛的访问情况,请问这个变量可以查到蜘蛛吗?如果不能用什么方法呢?

------解决方案--------------------
可以
if( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'baiduspider') !== false ) {
//相关处理
}
------解决方案--------------------
嗯,这种问题直接去百度搜索的指引里看一下就好了:

http://www.baidu.com/search/spider.htm
------解决方案--------------------

探讨

可以
if( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'baiduspider') !== false ) {
//相关处理
}
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