ÄAÂЪŶ¡·s¬ü¾Ç¡Iºë²Ó¤À¤u¡B±M·~³]p ¶q¨q»s§¹¬ü¨t²Î®a¨ã¡A³»¯Å®É©|«~¨ý¿ï¡I | ¥þ¨t¦C¬¡°Ê¦Ê¸µ¡.¨¾¤õ¦w¥þªù ®ð±K¹jµµ¡.°í©T@¥Î.¤u¼tª½Àç.Åwªï¬¢¸ß¡C |
[php] php§P断来访ªÌ¬O§_¬O·j¯Á¤Þ� |
©ÐªF¡G©P¤p©j µoªí®É¶¡¡G2016-10-31 | [ÀËÁ|] |
function is_crawler() { $userAgent = strtolower($_SERVER[\'HTTP_USER_AGENT\']); $spiders = array( \'Googlebot\', // Google ª¦¦ä \'Baiduspider\', // ¦Ê«×ª¦¦ä \'Yahoo! Slurp\', // ¶®ªêª¦¦ä \'YodaoBot\', // ¦³¹Dª¦¦ä \'msnbot\' // Bingª¦¦ä // §ó¦hª¦¦ä关键¦r ); foreach ($spiders as $spider) { $spider = strtolower($spider); if (strpos($userAgent, $spider) !== false) { return true; } } return false; } //该¥N码¤ù¬q来¦Û¤_: http://www.sharejs.com/codes/php/8945 ¤U±ªºphp¥N码ªþ带¤F§ó¦hªº»jµï标识 view sourceprint? function isCrawler() { echo $agent= strtolower($_SERVER[\'HTTP_USER_AGENT\']); if (!empty($agent)) { $spiderSite= array( \"TencentTraveler\", \"Baiduspider+\", \"BaiduGame\", \"Googlebot\", \"msnbot\", \"Sosospider+\", \"Sogou web spider\", \"ia_archiver\", \"Yahoo! Slurp\", \"YoudaoBot\", \"Yahoo Slurp\", \"MSNBot\", \"Java (Often spam bot)\", \"BaiDuSpider\", \"Voila\", \"Yandex bot\", \"BSpider\", \"twiceler\", \"Sogou Spider\", \"Speedy Spider\", \"Google AdSense\", \"Heritrix\", \"Python-urllib\", \"Alexa (IA Archiver)\", \"Ask\", \"Exabot\", \"Custo\", \"OutfoxBot/YodaoBot\", \"yacy\", \"SurveyBot\", \"legs\", \"lwp-trivial\", \"Nutch\", \"StackRambler\", \"The web archive (IA Archiver)\", \"Perl tool\", \"MJ12bot\", \"Netcraft\", \"MSIECrawler\", \"WGet tools\", \"larbin\", \"Fish search\", ); foreach($spiderSite as $val) { $str = strtolower($val); if (strpos($agent, $str) !== false) { return true; } } } else { return false; } } if (isCrawler()){ echo \"§A¦n»jµïºë¡I\"; } else{ echo \"§A¤£¬O»jµïºë°Ú¡I\"; } //该¥N码¤ù¬q来¦Û¤_: http://www.sharejs.com/codes/php/8945 |