用手機打開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;
}
}
|
新聞熱點
疑難解答