1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  2. <html xmlns="http://www.w3.org/1999/xhtml"> 
  3. <head> 
  4. <title>无标题文档</title> 
  5. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
  6. <link rel="stylesheet" type="text/css" href="/c3.css" />  
  7. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />  
  8. <meta http-equiv="Content-Language" content="zh-cn" />  
  9. <meta name="robots" content="all" />  
  10. <meta name="author" content="lunanzuche.com" />  
  11. <meta name="Copyright" content="Copyright www.lunanzuche.com All Rights Reserved." />  
  12. <meta name="MSSmartTagsPreventParsing" content="true" />  
  13. <meta http-equiv="p_w_picpathtoolbar" content="false" />  
  14.  
  15. </head> 
  16.  
  17. <body> 
  18. <?PHP 
  19. /** 
  20. * 判断是否为搜索引擎蜘蛛 
  21. * @author Eddy 
  22. * @return bool 
  23. */ 
  24. function isCrawler(){ 
  25. $agentstrtolower($_SERVER['HTTP_USER_AGENT']); 
  26. if (!empty($agent)) { 
  27. $spiderSitearray
  28. "TencentTraveler", 
  29. "Baiduspider+", 
  30. "BaiduGame", 
  31. "Googlebot", 
  32. "msnbot", 
  33. "Sosospider+", 
  34. "Sogou web spider", 
  35. "ia_archiver", 
  36. "Yahoo! Slurp", 
  37. "YoudaoBot", 
  38. "Yahoo Slurp", 
  39. "MSNBot", 
  40. "Java (Often spam bot)", 
  41. "BaiDuSpider", 
  42. "Voila", 
  43. "Yandex bot", 
  44. "BSpider", 
  45. "twiceler", 
  46. "Sogou Spider", 
  47. "Speedy Spider", 
  48. "Google AdSense", 
  49. "Heritrix", 
  50. "Python-urllib", 
  51. "Alexa (IA Archiver)", 
  52. "Ask", 
  53. "Exabot", 
  54. "Custo", 
  55. "OutfoxBot/YodaoBot", 
  56. "yacy", 
  57. "SurveyBot", 
  58. "legs", 
  59. "lwp-trivial", 
  60. "Nutch", 
  61. "StackRambler", 
  62. "The web archive (IA Archiver)", 
  63. "Perl tool", 
  64. "MJ12bot", 
  65. "Netcraft", 
  66. "MSIECrawler", 
  67. "WGet tools", 
  68. "larbin", 
  69. "Fish search", 
  70. ); 
  71.     foreach($spiderSite as $val) { 
  72.         $str = strtolower($val); 
  73.         if (strpos($agent, $str) !== false) { 
  74.         return true; 
  75.         } 
  76.     } 
  77. }else { 
  78.     return false; 
  79.     } 
  80. }  
  81. ?> 
  82. </body> 
  83. </html> 

以上主要就是根据函数进行判断