ecshop判断ipad自动访问wap版
ecshop有一个mobile目录,里面的文件是开启手机访问时的界面效果文件,它的访问端判断是写在index.php中:
- $uachar = "/(nokia|sony|ericsson|mot|samsung|sgh|lg|philips|panasonic|alcatel|lenovo|cldc|midp|mobile)/i";
- if(($ua == '' || preg_match($uachar, $ua))&& !strpos(strtolower($_SERVER['REQUEST_URI']),'wap'))
- {
- $Loaction = 'mobile/';
- if (!emptyempty($Loaction))
- {
- ecs_header("Location: $Loactionn");
- exit;
- }
- }
用ipad访问时就会显示电脑版,有些客户提出需要ipad也访问wap版,解决方法如下:
- $uachar = "/(nokia|sony|ericsson|mot|samsung|sgh|lg|philips|panasonic|alcatel|lenovo|cldc|midp|mobile)/i";
- $smartuachar = "/(ipad)/i";
- if(!(preg_match($smartuachar, $ua)) && ($ua == '' || preg_match($uachar, $ua))&& !strpos(strtolower($_SERVER['REQUEST_URI']),'wap'))
- {
- $Loaction = 'mobile/';
- if (!emptyempty($Loaction))
- {
- ecs_header("Location: $Loactionn");
- exit;
- }
- }

