用手機(jī)打開ecshop網(wǎng)店,就會被重定向到mobile文件夾,如果打開wap功能,就能看到wap版的網(wǎng)站。但現(xiàn)在智能手機(jī)橫行,iphone、安卓可以跟電腦一樣瀏覽和購物,這個(gè)wap功能就有點(diǎn)雞肋。現(xiàn)在把它屏蔽掉
編輯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;
}
}
替換后的,并補(bǔ)充了一些其他移動端系統(tǒng)的訪問
$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;
}
}
新聞熱點(diǎn)
疑難解答
圖片精選