如何实现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: $Loactionn");
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.xhisp.com';
if (!empty($Loaction))
{
header("Location: $Loactionn");
exit;
}
}
注 红色字体链接地址是你想让你的手机访问时候跳转到的网站地址,改成你想跳转的就好。
