您的位置:首页 > 运维架构 > 网站架构

修正解决智能手机访问ECshop网站的问题

2012-08-21 16:04 337 查看
打开ECshop文件,找到修改index.php

找到 $ua = strtolower($_SERVER['HTTP_USER_AGENT']);

做如下代码修改(增加了普通手机的ua代码,增加了智能手机的ua变量)

$uachar = "/(nokia|sony|ericsson|mot|samsung|sgh|lg|philips|panasonic|alcatel|lenovo|cldc|midp|coolpad|k-touch|tcl|oppo|doov|amoi|bbk|cect|amoi|zte|huawei)/i";

$smartuachar = "/(iphone|ipad|android|smartphone|windows)/i";

判别是iphone ipad android smartphone windows类手机就按普通web方式处理,其他手机按wap处理

if(!(preg_match($smartuachar, $ua)) && ($ua == '' || preg_match($uachar, $ua))&& !strpos(strtolower($_SERVER['REQUEST_URI']),'wap'))

这样能让智能机访问不会为空,打开不了的情况!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐