如何实现ecshop程序手机访问跳转到我想跳转到的页面,下面好模板的技术帮你解决。
首先打开根目录下 index.php,找到
<p style="text-indent: 2em;">$ua = strtolower($_SERVER['HTTP_USER_AGENT']);<br><br>$uachar = "/(nokia|sony|ericsson|mot|samsung|sgh|lg|philips|panasonic|alcatel|lenovo|cldc|midp|mobile)/i";<br><br>if(($ua == '' || preg_match($uachar, $ua))&& !strpos(strtolower($_SERVER['REQUEST_URI']),'wap'))<br>{<br> $Loaction = 'm.baisihan.com';<br> if (!empty($Loaction))<br> {<br> ecs_header("Location: $Loactionn");<br> exit;<br> }<br>}<br></p>
如图所示 代码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.ldhost.cn';
if (!empty($Loaction))
{
header("Location: $Loactionn");
exit;
}
}
这里的www.ldhost.cn可以更换为你想要换的网址
(责任编辑:好模板) |