PHP 函数检测访问者是否为搜索引擎蜘蛛
function isBot() { $botlist = array( 'Teoma', 'alexa', 'froogle', 'Gigabot', 'inktomi', 'looksmart', 'URL_Spider_SQL', 'Firefly', 'NationalDirectory', 'Ask Jeeves', 'TECNOSEEK', 'InfoSeek', 'WebFindBot', 'girafabot', 'crawler', 'www.galaxy.com', 'Googlebot', 'Scooter', 'Slurp', 'msnbot', 'appie', 'FAST', 'WebBug', 'Spade', 'ZyBorg', 'rabaz', 'Baiduspider', 'Feedfetcher-Google', 'TechnoratiSnoop', 'Rankivabot', 'Mediapartners-Google', 'Sogou web spider', 'WebAlta Crawler', 'TweetmemeBot', 'Butterfly', 'Twitturls', 'Me.dium', 'Twiceler' );
foreach($botlist as $bot) {
if(strpos($_SERVER['HTTP_USER_AGENT'], $bot) !== false) {
return true;
}
}
return false;
}
if(isBot()) { echo 'You are a bot!'; } else { echo 'You are not a bot!'; }
原文地址: https://www.cveoy.top/t/topic/msEA 著作权归作者所有。请勿转载和采集!