Heim >Backend-Entwicklung >PHP-Tutorial >Wie erkennt man, ob der WeChat-Browser geöffnet ist und ein Bild angezeigt wird?

Wie erkennt man, ob der WeChat-Browser geöffnet ist und ein Bild angezeigt wird?

WBOY
WBOYOriginal
2016-09-25 09:23:091170Durchsuche

Wenn Sie WeChat verwenden, um die Homepage dieser Website zu öffnen und auf ein Produkt klicken, erscheint dieses Bild: Der Kauf kann nicht innerhalb von WeChat getätigt werden, klicken Sie bitte auf die obere rechte Ecke.
Aber es gibt keine solche Identifikation auf der Produktfreigabeseite. Wenn Sie auf „Tmall“ klicken, um aufzurufen, gelangen Sie direkt zu Taobao. Ich möchte eine Identifikation hinzufügen, wenn Sie auf „Aufschnappen“ klicken, aber ich weiß nicht, wo ich sie hinzufügen soll Es verwendet dieses Programm. Ich weiß nicht, welcher Code für das thinkPHP-Framework benötigt wird. Kann mir jemand helfen?

Wie erkennt man, ob der WeChat-Browser geöffnet ist und ein Bild angezeigt wird?
Wie erkennt man, ob der WeChat-Browser geöffnet ist und ein Bild angezeigt wird?

<code>


<include file="public:head"></include>
<script src="__STATIC__/jwap/js/jquery-1.8.0.js"></script>
<link type="text/css" rel="stylesheet" href="__STATIC__/jwap/css/alert.css">
<link type="text/css" rel="stylesheet" href="__STATIC__/jwap/css/global.css">


       
<div class="main">
<include file="public:header"></include>
<include file="public:top"></include>
        <div class="app">
    <header class="head" id="head">
        <div class="fixtop">
                        <span id="t-find"><a class="btn btn-left btn-back" href="javascript:window.history.go(-1)" title="返回上一页"></a></span>
                        <span id="t-index">商品详情</span>
                        <span id="t-user"><a class="btn btn-left btn-back-home" href="%7B:C('ftx_header_html')%7D" title="返回首页"></a></span>
                    </div>        
    </header>
        
            <div id="item">
                <div class="item-good">
                    <div class="img_show">
                        <ul id="target" class="clear">
                            <li><a href="%7B:U('jump/index',array('id'=>%24item%5B'num_iid'%5D))%7D" rel="nofollow"> <img  src="%7B%24item%5B'pic_url'%5D%7D" alt="Wie erkennt man, ob der WeChat-Browser geöffnet ist und ein Bild angezeigt wird?" ></a></li>
                        </ul>                
                    </div>
                    <div class="list-price buy">
<span class="price-new ml"><i>¥</i>{$item.coupon_price}</span><i class="del f14 ml2">¥{$item.price}</i><if condition="$item.cu neq ''"><em class="icon-gai ml2">{$item.cu}</em></if> </div>
                    <h1>{$item.title}</h1>
                    <div class="better_change">
                        <h3>精挑细选</h3>
                        <ul class="better_show clear">
                            <li>
                                <div class="better_info">
                                    <i class="xp"></i>
                                    <span>新品特价</span>
                                </div>
                            </li>
                            <li>
                                <div class="better_info">
                                    <i class="xs"></i>
                                    <span>限时特卖</span>
                                </div>
                            </li>
                            <li>
                                <div class="better_info">
                                    <i class="cx"></i>
                                    <span>诚信品牌</span>
                                </div>
                            </li>
                            <li>
                                <div class="better_info">
                                    <i class="tj"></i>
                                    <span>人气推荐</span>
                                </div>
                            </li>
                            <li class="last">
                                <div class="better_info">
                                    <i class="by"></i>
                                    <span>全国包邮</span>
                                </div>
                            </li>
                        </ul>
                    </div>

                </div>
                <if condition="$item.class eq 'start'">
                    <a class="btn-pay buy">即将开始</a>
                <elseif condition="$item.class eq 'gone'"></elseif>
                    <a class="btn-pay buy">已卖光</a>
                <elseif condition="$item.class eq 'gone'"></elseif>
                    <a class="btn-pay buy">已结束</a>
                <elseif condition="$item.class eq 'buy'"></elseif>
        <if condition="$item.shop_type eq 'B' "><a href="%7B:U('jump/index',array('id'=>%24item%5B'num_iid'%5D))%7D" target="_self" class="btn-pay buy" rel="nofollow">去天猫抢购</a></if>
        <if condition="$item.shop_type eq 'C' "><a href="%7B:U('jump/index',array('id'=>%24item%5B'num_iid'%5D))%7D" target="_self" class="btn-pay buy" rel="nofollow">去淘宝抢购</a></if>
        <if condition="$item.shop_type eq 'M' "><a href="%7B:U('jump/index',array('id'=>%24item%5B'id'%5D))%7D" target="_self" class="btn-pay buy" rel="nofollow">去美丽说抢购</a></if>    
        </if>            
                <div class="bady-part">
                    <div id="bady-tab" class="bady-tab clear">
                        <ul>
                            <li>
<a href="javascript:;">图文详情</a> </li>
                            <li>
<a href="javascript:;">产品参数</a> </li>
                            <li>
<a href="javascript:;">商品评论</a> </li>
                        </ul>
                    </div>
                    <div class="tab1">
                    {$item.desc}
                    </div>
                     <!-- 商品评论 -->
                    <div class="com-big tab3" style="display: none;">
                        <div class="com-list">
                            <ul>
                                <volist name="feedback" id="feedback">
                                <li>
                                    <div class="rate-user-info">
                                        <span class="rate-user">{$feedback.nicker}
                                            <span class="rate-user-grade">
                                                <em class="tm-icon t3"> </em>
                                                <em class="tm-icon vip-icon blue_2"></em>
                                            </span>
                                        </span>
                                        <span class="rate-right fr"> <em class="rate-time">2015-07-30 14:53:31</em><em>评论来自 <if condition="$item.shop_type eq 'C' ">淘宝</if><if condition="$item.shop_type eq 'B' ">天猫</if><if condition="$item.shop_type eq 'M' ">美丽说</if></em></span>
                                        <div class="rate-leirong">{$feedback.feedback}</div>
                                    </div>
                                </li>
                                </volist>
                          </ul>
                        </div>
                    </div>
                    
                    <!-- 规格参数 -->
                    <div class="com-big tab2" style="display: none;">
                        <div class="com-list">
                            <ul>
                                <volist name="props" id="guige">
                                <li>
                                    <div class="shop_info clear">
                                        <span>{$guige.name}:</span>
                                        <strong>{$guige.value}</strong>
                                    </div>
                                </li>
                               </volist>
                            </ul>
                        </div>
                    </div>
                    
                   
                </div>
            </div>

                 <div class="normal item-recommend clear">
                <h3><span>猜你还喜欢:</span></h3>
                <ul class="goods-list clear" id="goods_block">
                <include file="public:hotitems"></include>
                </ul>
            </div>
                 <div class="normal user-like clear">
                    <h3>已有{$wholike}人收藏</h3>
                    <p>
                    <volist name="whos" id="val">
               <a href="%7B:U('user/like')%7D" target="_self"><img src="%7B:avatar(%24val%5B'id'%5D,%2032)%7D"    style="max-width:90%" height="32px" alt="Wie erkennt man, ob der WeChat-Browser geöffnet ist und ein Bild angezeigt wird?" title="Wie erkennt man, ob der WeChat-Browser geöffnet ist und ein Bild angezeigt wird?"></a>
               </volist>                    
                    </p>                    
                </div>
                <div class="buy_btn clear">
                <a href="%7B:C('ftx_header_html')%7D" class="go_home"><img  src="__STATIC__/jwap/images/home.png" alt="Wie erkennt man, ob der WeChat-Browser geöffnet ist und ein Bild angezeigt wird?" >返回首页</a>
                <div class="buy_info">
                <if condition="$item.class eq 'start'">
                            <a class="go_tmall">即将开始</a>
                        <elseif condition="$item.class eq 'gone'"></elseif>
                            <a class="go_tmall">已卖光</a>
                        <elseif condition="$item.class eq 'gone'"></elseif>
                            <a class="go_tmall">已结束</a>
                        <elseif condition="$item.class eq 'buy'"></elseif>
                            <eq name="item.is_quan" value="1">
                
                            <a href="%7B%24item.quan_url%7D" target="_self" class="go_tmall buy" rel="nofollow">领取{$item.quan_price}元优惠券<i class="gtbuy"></i></a>
                            <if condition="$item.shop_type eq 'B' "><a href="%7B:U('jump/index',array('id'=>%24item%5B'num_iid'%5D))%7D" target="_self" class="app_load  buy" rel="nofollow">去天猫抢购</a></if>
                            <if condition="$item.shop_type eq 'C' "><a href="%7B:U('jump/index',array('id'=>%24item%5B'num_iid'%5D))%7D" target="_self" class="app_load buy" rel="nofollow">去淘宝抢购</a></if>
                            <if condition="$item.shop_type eq 'M' "><a isconvert="1" href="%7B:U('jump/index',array('id'=>%24item%5B'id'%5D))%7D" target="_self" class="app_load  buy" rel="nofollow">去美丽说</a></if>
                            </eq>
                            
                            <eq name="item.is_quan" value="0">
                            <if condition="$item.shop_type eq 'B' "><a href="%7B:U('jump/index',array('id'=>%24item%5B'num_iid'%5D))%7D" target="_self" class="go_tmall" rel="nofollow">去天猫抢购<i></i></a></if>
                            <if condition="$item.shop_type eq 'C' "><a href="%7B:U('jump/index',array('id'=>%24item%5B'num_iid'%5D))%7D" target="_self" class="go_tmall" rel="nofollow">去淘宝抢购<i></i></a></if>
                            <if condition="$item.shop_type eq 'M' "><a isconvert="1" href="%7B:U('jump/index',array('id'=>%24item%5B'id'%5D))%7D" target="_self" class="go_tmall" rel="nofollow">去美丽说<i></i></a></if>
                
                        <a class="app_load joa_load_app" data-pid="{$item.num_iid}" title="{$item.title}" href="javascript:;">点这里<br>放入收藏夹</a>
                        </eq>
                    </if>
</div>
                
            </div>
            
            <include file="public:footer"></include>
<script type="text/javascript">
var FTXIAER = {
    root: "__ROOT__",
    site: "{:C('ftx_header_html')}",
    uid: "<?php echo $visitor['id'];?>", 
    url: {}
};
var lang = {};
<volist name=":L('js_lang')" id="val">lang.{$key} = "{$val}";
</script>
           </div>
           </div>

    
    <script type="text/javascript">
        $("#bady-tab li").eq(0).addClass("active");        
        $('#bady-tab li').on('click', function(){
        $("#bady-tab li").removeClass("active");
        $(this).addClass("active");
        $(".tab1,.tab2,.tab3").hide();
        $(".tab"+($(this).index()+1)).show();
        });        
    </script>
    <script type="text/javascript" src="__STATIC__/jwap/js/like.js"></script>
    <include file="public:footjs"></include>

</code>
Dies ist die Produktdetailseite

<code>


<include file="public:head"></include>    
<link type="text/css" rel="stylesheet" href="__STATIC__/jwap/css/alert.css">
<link type="text/css" rel="stylesheet" href="__STATIC__/jwap/css/global.css">


<if condition="C('ftx_popup_status') eq '1'">
  <link type="text/css" rel="stylesheet" href="__STATIC__/jwap/css/popup.css">
<div id="popup_scroll">
    <div id="popup_opacity"></div>
    <div id="popup_content">
        <div id="popup"><dl><dt>
<div id="closebtn" style="float:right;"><img src="__STATIC__/jwap/images/alert-close.png"    style="max-width:90%" height="32px" alt="先逛逛"></div>
<a href="%7B:C('ftx_popup_url')%7D" data-gid="521" class="popup_show_maidian"><img  src="%7B:C('ftx_site_url')%7D%7B:C('ftx_popup_img')%7D"    style="max-width:90%"  style="max-width:90%" alt="Wie erkennt man, ob der WeChat-Browser geöffnet ist und ein Bild angezeigt wird?" ></a>
</dt></dl></div>
</div>
</div>
<script type="text/javascript" src="__STATIC__/jwap/js/popup.js"></script>
</if>
<div class="main">    
<include file="public:header"></include>
<include file="public:top"></include>
<include file="public:dapp"></include>
<div class="app">
    <div class="search_warp">
    <span id="classify" class="classify"><a href="javascript:;" class="btn btn-left btn-type"></a></span>
        <div class="search" style="float: none;">
        <form name="search" action="%7B:C('search/index')%7D" method="get" id="search">
<input type="hidden" name="m" value="search"><input type="hidden" name="a" value="index"><div class="seek_main">
<input type="text" name="k" onclick="if(this.value=='请输入内容'){this.value='';this.className='seek_input seek_input_h'}" onblur="if(this.value==''){this.value='请输入内容';this.className='seek_input seek_input_f'}" class="seek_input seek_input_f" value="请输入内容"><button type="submit" id="k" onclick="document.getElementById('k').value=encodeURI(document.getElementById('k').value);getId('search').submit()" class="seek_btn" value="搜本站"><img  src="__STATIC__/jwap/images/search.png" alt="Wie erkennt man, ob der WeChat-Browser geöffnet ist und ein Bild angezeigt wird?" ></button>
</div>
</form>
</div>
        
      </div>    
    <header id="head" class="head">
        <div class="fixtop">
        <span id="classify" class="classify"><a href="javascript:;" class="btn btn-left btn-type"></a></span>
        <span id="t-index">{:C('ftx_site_name')}</span>
        <span id="user"><a href="javascript:;" class="sign_btn btn btn-right btn-sign"></a></span>
    </div>
    </header>
         
{:R('advert/index', array(10), 'Widget')}

<div id="ct">
<link rel="stylesheet" type="text/css" href="__STATIC__/jwap/css/zhuanti.css?ts=201510111950">
  <div class="index_w">
    <ul class="category">
    <nav type="lists" style="other">
    <volist name="data" id="val">
      <li class="ffxgo_1" data-url="{$val.link}">
        <span>
          <img src="%7B:attach(get_thumb(%24val%5B'icon'%5D,%20'_m'),'m')%7D" alt="{$val.name}">
        </span>
        <strong>{$val.name}</strong>
      </li>
     
    </volist>
    </nav>  
    </ul>
   
    <div class="hot_recommend">
    <nav type="lists" style="foot">
    <volist name="data" id="val">
      <!-- 每日更新 -->
      <if condition="$val['alias'] eq 'new' ">
      
      <dl class="today ffxgo_1" data-url="{$val.link}">
                <dt class="tit t1" style="width: 60px;height: 15px;background:url({:attach(get_thumb($val['icon1'], '_m'),'m')});  background-size: contain;
  background-repeat: no-repeat;">{$val.name}</dt>
                <dd class="txt">{$val.des}</dd>
                <dd class="img">
<img src="%7B:attach(get_thumb(%24val%5B'icon'%5D,%20'_m'),'m')%7D"    style="max-width:90%" alt="{$val.name}"><span></span>
</dd>
                <!-- dl-->
            </dl>
     </if>
     <if condition="$val['alias'] eq 'shijian' ">
        <dl class="rec_item ffxgo_1" data-url="{$val.link}">
          <dt class="tit">{$val.name}</dt>
          <dd class="txt">{$val.des}</dd>
          <dd class="img"><img src="%7B:attach(get_thumb(%24val%5B'icon'%5D,%20'_m'),'m')%7D"    style="max-width:90%" alt="好货早收藏"></dd>                   <!-- dl-->
       </dl>     
      
      </if>
    </volist>
    </nav> 
    </div>
    <script type="text/javascript">   

</script>
    <div class="hot_bottom">
    <nav type="lists" style="foot">
    <volist name="data" id="val">
    <if condition="$val['alias'] eq 'hot' ">
      <dl class="add_item ffxgo_1" data-url="{$val.link}">
                <dt class="img">
                    <img  src="%7B:attach(%24val%5B'icon'%5D,'m')%7D"    style="max-width:90%"  style="max-width:90%" alt="Wie erkennt man, ob der WeChat-Browser geöffnet ist und ein Bild angezeigt wird?" >
                </dt>
                <dd>
                    <p class="tit t6">{$val.name}</p>
                    <p class="txt">{$val.des}</p>
                </dd>
       </dl>
      </if>
    <if condition="$val['alias'] eq 'temai' ">
      <dl class="add_item ffxgo_1" data-url="{$val.link}">
                <dt class="img">
                    <img  src="%7B:attach(%24val%5B'icon'%5D,'m')%7D"    style="max-width:90%"  style="max-width:90%" alt="Wie erkennt man, ob der WeChat-Browser geöffnet ist und ein Bild angezeigt wird?" >
                </dt>
                <dd>
                    <p class="tit">
                        <span class="fc_orange">{$val.name}</span>
                        <if condition="$val['hot'] eq '1'"><span class="icon_saleShop">热卖</span></if><if condition="$val['hot'] eq '2'"><span class="icon_bestBuy">精选</span></if>
                    </p>
                    <p class="txt">{$val.des}</p>
                </dd>
            </dl>
      </if>
    </volist>
    </nav>
    </div>
  </div>
</div>
<script type="text/javascript">   
 $(".ffxgo_1").off("click").on("click",function(){
       window.location.href = $(this).attr("data-url");
  });
</script>
<div id="goods">
<section class="goods" id="goods">
    <ul class="goods-list clear">
<include file="public:itemlist"></include>    
    </ul>
</section>
<div class="paging">
<div class="paging-nav">
{$page}
</div>    
</div>
</div>
<include file="public:footer"></include>
</div>
</div>
<include file="public:footjs"></include>
<script type="text/javascript">document.getElementById("back_top").style.display = "none";
window.onscroll = function () {
    if (document.documentElement.scrollTop + document.body.scrollTop > 100) {
        document.getElementById("back_top").style.display = "block";
    }
    else {
        document.getElementById("back_top").style.display = "none";
    }
}
</script><script type="text/javascript">$(document).ready(function(){  

        var jumpurl=$("#jumpurl").text();
        if(getck("showdiv") == "")
        {
            var data = new Date();
            var timestr = data.getFullYear() + "-" + (Number(data.getMonth())+1) + "-" + data.getDate() + " " + data.getHours() + ":" + data.getMinutes() + ":" + data.getSeconds();
            document.cookie="showdiv=" + timestr;
        }
        else
        {
            var date_ = convertdate(getck("showdiv"));
            var data = new Date();
            var num = Number(data.getTime()) - Number(date_.getTime());
            if(num >= 24*3600000)//已经过期重新设置
            {
               document.cookie="showdiv=";
            }
        }
        $("#closebtn").click(function(){ document.cookie="isshow=true";$("#ffxiabige_scroll").fadeOut("slow");});
        $("#add_fav").click(function(){ 
            window.open(jumpurl); 
            document.cookie="isshow=true";
            $("#ffxiabige_scroll").fadeOut("slow");
        });

        $("#welcome_img").click(function(){
              window.open(jumpurl); 
              document.cookie="isshow=true";
              $("#ffxiabige_scroll").fadeOut("slow");
        });

        setTimeout("showdiv()",1000);  //这里修改打开网页多久之后显示提示
        });

    function showdiv()
    { 
       if(getck("isshow")  == "true")
       {
         return;
       }
       else
       {
         if(getck("showdiv") == "")
         {
            $("#ffxiabige_scroll").width(document.body.clientWidth);
            $("#ffxiabige_scroll").height(document.body.clientHeight);
            $("#ffxiabige_scroll").show(400);
         }
         else
         {
            var date_ = convertdate(getck("showdiv"));
            var data = new Date();
            var num = Number(data.getTime()) - Number(date_.getTime());
            if(num >= 24*3600000)//已经过期重新设置
            {
                document.cookie="showdiv=";
                $("#ffxiabige_scroll").width(document.body.clientWidth);
                $("#ffxiabige_scroll").height(document.body.clientHeight);
                $("#ffxiabige_scroll").show();
            } 
         }
       }
    }

    var acookie=document.cookie.split("; ");
    function getck(sname)
    {
       //获取单个cookies
        for(var i=0;i<acookie.length;i++){
        var arr=acookie[i].split("=");
        if(sname==arr[0]){
        if(arr.length>1)
        return unescape(arr[1]);
        else
        return "";
        }}
        return "";
    }

    function convertdate(datestr)
    {
      var date_hidden = datestr;
      date_hidden = date_hidden.replace(":","-");
      date_hidden = date_hidden.replace(":","-");
      date_hidden = date_hidden.replace(" ","-");
      var date = new Date(Number(date_hidden.split("-")[0]),Number(date_hidden.split("-")[1])-1,Number(date_hidden.split("-")[2]),Number(date_hidden.split("-")[3]),Number(date_hidden.split("-")[4]),Number(date_hidden.split("-")[5]));
      return date;  
    }

    function clearcookie()
    {
        document.cookie="showdiv=";
        document.cookie="isshow=";location.href=location.href;
    }   
</script>

</code>
Dies ist die Homepage. Was sollte geändert werden?

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn