ecshop 手机端没做和电脑一样显示
有以下方案的提出:
如何让手机终端访问显示与电脑终端一样的界面?
找了半天,是下面这段代码在起效果,删除即可!
找到根目录下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|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;
}
}
如图所示 代码24行----39行
将上面代码替换成
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
$uachar = "/(iphone|android|phone|mobile|wap|netfront|java|opera mobi|opera mini|ucweb|windows
ce|symbian|series|webos|sony|blackberry|dopod|nokia|samsung|palmsource|xda|pieplus|meizu|midp|cldc
|motorola|foma|docomo|up.browser|up.link|blazer|helio|hosin|huawei|novarra|coolpad|webos|techfaith|palmsource
|alcatel|amoi|ktouch|nexian|ericsson|philips|sagem|wellcom|bunjalloo|maui|smartphone|iemobile|spice|bird|zte-|longcos|pantech|gionee|portalmmm|jig
browser|hiptop|benq|haier|^lct|320x320|240x320|176x220)/i";
if(($ua == '' || preg_match($uachar, $ua))&& !strpos(strtolower($_SERVER['REQUEST_URI']),'wap'))
{
$Loaction = 'http://www.68ecshop.com';
if (!empty($Loaction))
{
header("Location: $Loaction\n");
exit;
}
}
注 红色字体链接地址是你想让你的手机访问时候跳转到的网站地址,改成你想跳转的就好。