用手机打开ecshop网店,就会被重定向到mobile文件夹,如果打开wap功能,就能看到wap版的网站。但现在智能手机横行,iphone、安卓可以跟电脑一样浏览和购物,这个wap功能就有点鸡肋。现在把它屏蔽掉
编辑index.php,把下面这段代码替换一下
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
$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;
}
}
替换后的,并补充了一些其他移动端系统的访问
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);$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";
if(!(preg_match($smartuachar, $ua)) && ($ua == ” || preg_match($uachar, $ua))&& !strpos(strtolower($_SERVER['REQUEST_URI']),’wap’))
//if(($ua == '' || preg_match($uachar, $ua))&& !strpos(strtolower($_SERVER['REQUEST_URI']),'wap'))
{
$Loaction = 'mobile/';
if (!empty($Loaction))
{
ecs_header("Location: $Loaction/n");
exit;
}
}
新闻热点
疑难解答