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

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

Jun 13, 2016 am 10:26 AM
agent http server strtolower

请问$_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 of this Website
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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What does http status code 520 mean? What does http status code 520 mean? Oct 13, 2023 pm 03:11 PM

What does http status code 520 mean?

How to install, uninstall, and reset Windows server backup How to install, uninstall, and reset Windows server backup Mar 06, 2024 am 10:37 AM

How to install, uninstall, and reset Windows server backup

How to use Nginx Proxy Manager to implement automatic jump from HTTP to HTTPS How to use Nginx Proxy Manager to implement automatic jump from HTTP to HTTPS Sep 26, 2023 am 11:19 AM

How to use Nginx Proxy Manager to implement automatic jump from HTTP to HTTPS

Understand common application scenarios of web page redirection and understand the HTTP 301 status code Understand common application scenarios of web page redirection and understand the HTTP 301 status code Feb 18, 2024 pm 08:41 PM

Understand common application scenarios of web page redirection and understand the HTTP 301 status code

What is http status code 403? What is http status code 403? Oct 07, 2023 pm 02:04 PM

What is http status code 403?

Convert string to lowercase using PHP function 'strtolower' Convert string to lowercase using PHP function 'strtolower' Jul 24, 2023 pm 12:34 PM

Convert string to lowercase using PHP function 'strtolower'

http request 415 error solution http request 415 error solution Nov 14, 2023 am 10:49 AM

http request 415 error solution

Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files Sep 12, 2023 pm 01:15 PM

Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files

See all articles