判断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 (!empty($Loaction)) { ecs_header("Location: $Loaction\n");

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 (!empty($Loaction)) { ecs_header("Location: $Loaction\n");

exit; }

}

人生就是要感受美丽的善良的,丑恶的病态的。

判断ipad自动访问wap版

相关文章:

你感兴趣的文章:

标签云: