当前位置:首页 > CMS教程 > ecshop > 列表

ecshop判断ipad自动访问wap版

发布:smiling 来源: PHP粉丝网  添加日期:2014-07-08 16:43:27 浏览: 评论:0 

ecshop有一个mobile目录,里面的文件是开启手机访问时的界面效果文件,它的访问端判断是写在index.php中:

  1. $uachar = "/(nokia|sony|ericsson|mot|samsung|sgh|lg|philips|panasonic|alcatel|lenovo|cldc|midp|mobile)/i"; 
  2. if(($ua == '' || preg_match($uachar, $ua))&& !strpos(strtolower($_SERVER['REQUEST_URI']),'wap')) 
  3. { 
  4.     $Loaction = 'mobile/'; 
  5.     if (!emptyempty($Loaction)) 
  6.     { 
  7.         ecs_header("Location: $Loaction\n"); 
  8.         exit; 
  9.     } 
  10. } 

用ipad访问时就会显示电脑版,有些客户提出需要ipad也访问wap版,解决方法如下:

  1. $uachar = "/(nokia|sony|ericsson|mot|samsung|sgh|lg|philips|panasonic|alcatel|lenovo|cldc|midp|mobile)/i"; 
  2. $smartuachar = "/(ipad)/i"; 
  3. if(!(preg_match($smartuachar, $ua)) && ($ua == '' || preg_match($uachar, $ua))&& !strpos(strtolower($_SERVER['REQUEST_URI']),'wap')) 
  4. { 
  5.     $Loaction = 'mobile/'; 
  6.     if (!emptyempty($Loaction)) 
  7.     { 
  8.         ecs_header("Location: $Loaction\n"); 
  9.         exit; 
  10.     } 
  11. } 

Tags: ecshop ipad 访问wap版

分享到: