Discuz是否搜索引擎蜘蛛
function getrobot() {if(!defined('IS_ROBOT')) {$kw_spiders = 'Bot|Crawl|Spider|slurp|sohu-search|lycos|robozilla';$kw_browsers = 'MSIE|Netscape|Opera|Konqueror|Mozilla';if(!strexists($_SERVER['HTTP_USER_AGENT'], 'http://') && preg_match("/($kw_browsers)/i", $_SERVER['HTTP_USER_AGENT'])) {define('IS_ROBOT', FALSE);} elseif(preg_match("/($kw_spiders)/i", $_SERVER['HTTP_USER_AGENT'])) {define('IS_ROBOT', TRUE);} else {define('IS_ROBOT', FALSE);}}return IS_ROBOT;}
此函数来源于dz论坛程序. IS_ROBOT 被定义为一个常量.
IS_ROBOT?:'你是搜索引擎蜘蛛吧':'你是人';