ShopWT官网-php多用户商城系统-在路上

标题: 二级域名自动跳转WAP [打印本页]

作者: xuezhongyue    时间: 2016-6-22 22:16
标题: 二级域名自动跳转WAP
本帖最后由 xuezhongyue 于 2016-6-22 22:20 编辑

shop\templates\default\layout\store_common_layout.PHP
  1. <span style="line-height: 1.5; background-color: rgb(255, 255, 255);">这个</span><?php defined('InShoWT') or exit('Access Invalid!');?>
复制代码
把这代码替换下面的
  1. <?php defined('InShoWT') or exit('Access Invalid!');
  2.         $wapurl = WAP_SITE_URL;
  3.         $agent = $_SERVER['HTTP_USER_AGENT'];
  4.         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")){
  5.                 global $config;
  6.         if(!empty($config['wap_site_url'])){
  7.             $url = $config['wap_site_url'];
  8.             switch ($_GET['act']){
  9.                         case 'goods':
  10.                           $url .= '/tmpl/product_detail.html?goods_id=' . $_GET['goods_id'];
  11.                           break;
  12.                         case 'store_list':
  13.                           $url .= '/shop.html';
  14.                           break;
  15.                         case 'show_store':
  16.                           $url .= '/tmpl/store.html?store_id=' . $_GET['store_id'];
  17.                           break;
  18.                         }
  19.         } else {
  20.             $header("Location:$wapurl");
  21.         }
  22.         header('Location:' . $url);
  23.         exit();        
  24.         }
  25. ?>
复制代码
-------------------------------------------


作者: 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