84669인 학습
152542인 학습
20005인 학습
5487인 학습
7821인 학습
359900인 학습
3350인 학습
180660인 학습
48569인 학습
18603인 학습
40936인 학습
1549인 학습
1183인 학습
32909인 학습
是在PHP中做的判断,还是在web server中做的? 是在index.php中吗?这个文件前面有对host做处理,但没看到和user agent有关的逻辑。想请教一下discuzX3是在什么地方,如何做判断的? 谢谢啦~
闭关修行中......
没看到和user agent有关的逻辑
你居然没找到!
function checkmobile() { global $_G; $mobile = array(); static $touchbrowser_list =array('iphone', 'android', 'phone', 'mobile', 'wap', 'netfront', 'java', 'opera mobi', 'opera mini', 'ucweb', 'windows ce', 'symbian', 'series', 'webos', 'sony', 'blackberry', 'dopod', 'nokia', 'samsung', 'palmsource', 'xda', 'pieplus', 'meizu', 'midp', 'cldc', 'motorola', 'foma', 'docomo', 'up.browser', 'up.link', 'blazer', 'helio', 'hosin', 'huawei', 'novarra', 'coolpad', 'webos', 'techfaith', 'palmsource', 'alcatel', 'amoi', 'ktouch', 'nexian', 'ericsson', 'philips', 'sagem', 'wellcom', 'bunjalloo', 'maui', 'smartphone', 'iemobile', 'spice', 'bird', 'zte-', 'longcos', 'pantech', 'gionee', 'portalmmm', 'jig browser', 'hiptop', 'benq', 'haier', '^lct', '320x320', '240x320', '176x220', 'windows phone'); static $wmlbrowser_list = array('cect', 'compal', 'ctl', 'lg', 'nec', 'tcl', 'alcatel', 'ericsson', 'bird', 'daxian', 'dbtel', 'eastcom', 'pantech', 'dopod', 'philips', 'haier', 'konka', 'kejian', 'lenovo', 'benq', 'mot', 'soutec', 'nokia', 'sagem', 'sgh', 'sed', 'capitel', 'panasonic', 'sonyericsson', 'sharp', 'amoi', 'panda', 'zte'); static $pad_list = array('ipad'); $useragent = strtolower($_SERVER['HTTP_USER_AGENT']); if(dstrpos($useragent, $pad_list)) { return false; } if(($v = dstrpos($useragent, $touchbrowser_list, true))){ $_G['mobile'] = $v; return '2'; } if(($v = dstrpos($useragent, $wmlbrowser_list))) { $_G['mobile'] = $v; return '3'; //wml版 } $brower = array('mozilla', 'chrome', 'safari', 'opera', 'm3gate', 'winwap', 'openwave', 'myop'); if(dstrpos($useragent, $brower)) return false; $_G['mobile'] = 'unknown'; if(isset($_G['mobiletpl'][$_GET['mobile']])) { return true; } else { return false; } }
没看到和user agent有关的逻辑
你居然没找到!