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!"; }

用php写一个检测访问者是否是搜索引擎蜘蛛的函数

原文地址: https://www.cveoy.top/t/topic/5rq 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录