这句代码不支持360和搜狗的useragent
会改的发消息给我,红包答谢
- function checkrobot($useragent = '') {
- static $kw_spiders = array('bot', 'crawl', 'spider' ,'slurp', 'sohu-search', 'lycos', 'robozilla', '360Spider');
- static $kw_browsers = array('msie', 'netscape', 'opera', 'konqueror', 'mozilla');
- $useragent = strtolower(empty($useragent) ? $_SERVER['HTTP_USER_AGENT'] : $useragent);
- if(strpos($useragent, 'http://') === false && dstrpos($useragent, $kw_browsers)) return false;
- if(dstrpos($useragent, $kw_spiders)) return true;
- return false;
- }
复制代码
|