ShopWT官网-php多用户商城系统-在路上
标题:
二级域名自动跳转WAP
[打印本页]
作者:
xuezhongyue
时间:
2016-6-22 22:16
标题:
二级域名自动跳转WAP
本帖最后由 xuezhongyue 于 2016-6-22 22:20 编辑
shop\templates\default\layout\store_common_layout.PHP
<span style="line-height: 1.5; background-color: rgb(255, 255, 255);">这个</span><?php defined('InShoWT') or exit('Access Invalid!');?>
复制代码
把这代码替换下面的
<?php defined('InShoWT') or exit('Access Invalid!');
$wapurl = WAP_SITE_URL;
$agent = $_SERVER['HTTP_USER_AGENT'];
if(strpos($agent,"comFront") || strpos($agent,"iPhone") || strpos($agent,"MIDP-2.0") || strpos($agent,"Opera Mini") || strpos($agent,"UCWEB") || strpos($agent,"Android") || strpos($agent,"Windows CE") || strpos($agent,"SymbianOS")){
global $config;
if(!empty($config['wap_site_url'])){
$url = $config['wap_site_url'];
switch ($_GET['act']){
case 'goods':
$url .= '/tmpl/product_detail.html?goods_id=' . $_GET['goods_id'];
break;
case 'store_list':
$url .= '/shop.html';
break;
case 'show_store':
$url .= '/tmpl/store.html?store_id=' . $_GET['store_id'];
break;
}
} else {
$header("Location:$wapurl");
}
header('Location:' . $url);
exit();
}
?>
复制代码
-------------------------------------------
作者:
wang137113
时间:
2016-6-22 23:37
厉害,学习了
作者:
shopwt
时间:
2016-6-22 23:45
哦,终于明白了,谢谢出这教程提醒到了,之前的没注意到,之前的店铺的代码是调用公用页面,即shop\templates\default\layout\common_layout.php
后来店铺的头部专门新建这个页面store_common_layout.php,没有把这上面的跳转手机的相关代码加上去。
作者:
柒先生
时间:
2016-8-1 21:04
我的程序为什么没有这个文件?
欢迎光临 ShopWT官网-php多用户商城系统-在路上 (https://bbs.shopwt.com/)
Powered by Discuz! X3.4