通过今天一天的研究,终于发现了酷派手机为什么不能进WAP的原因
source/function/function_core.php- function checkmobile() {
- global $_G;
- $mobile = array();
- static $mobilebrowser_list =array('iphone', 'Android', 'phone', 'mobile','coolpad', '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', '176X320','480x320');
- $pad_list = array('pad', 'gt-p1000');
- $useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
- if(dstrpos($useragent, $pad_list)) {
- return false;
- }
- if(($v = dstrpos($useragent, $mobilebrowser_list, true))) {
- $_G['mobile'] = $v;
- return true;
- }
- $brower = array('mozilla', 'chrome', 'safari', 'opera', 'm3gate', 'winwap', 'openwave', 'myop');
- if(dstrpos($useragent, $brower)) return false;
- $_G['mobile'] = 'unknown';
- if($_GET['mobile'] === 'yes') {
- return true;
- } else {
- return false;
- }
- }
复制代码 上面的代码中因为先判断是否是Pad设备访问,然后再判断是否是手机访问。由于Pad的标识与酷派(Coolpad)的标识中都有Pad字样。因此,酷派就这样被判断成Pad设备了,自然也就跳转到电脑页面而非WAP了。
解决方法很简单,就是将PAD判断与酷派的判断更换一下先后顺序就可以了。如下:- function checkmobile() {
- global $_G;
- $mobile = array();
- static $mobilebrowser_list =array('iphone', 'Android', 'phone', 'mobile','coolpad', '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', '176X320','480x320');
- $pad_list = array('pad', 'gt-p1000');
- $useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
- if(($v = dstrpos($useragent, $mobilebrowser_list, true))) {
- $_G['mobile'] = $v;
- return true;
- }
- if(dstrpos($useragent, $pad_list)) {
- return false;
- }
- $brower = array('mozilla', 'chrome', 'safari', 'opera', 'm3gate', 'winwap', 'openwave', 'myop');
- if(dstrpos($useragent, $brower)) return false;
- $_G['mobile'] = 'unknown';
- if($_GET['mobile'] === 'yes') {
- return true;
- } else {
- return false;
- }
- }
复制代码 |