QQ微信跳转TP框架专用

#代码说明
仅限Thinkphp框架网站使用
手机QQ内打开,会自动跳转浏览器
微信内打开,需用用户手动跳转

#食用方式
将代码全部复制 粘贴到 网站根目录下index.php文件的顶端
注意:不要覆盖了 index.php里面的原代码,原代码保留

<span class="hljs-meta">&lt;?php</span>$conf[<span class="hljs-string">'qqjump'</span>]=<span class="hljs-number">1</span>;<span class="hljs-keyword">if</span>(strpos($_SERVER[<span class="hljs-string">'HTTP_USER_AGENT'</span>], <span class="hljs-string">'QQ/'</span>)||strpos($_SERVER[<span class="hljs-string">'HTTP_USER_AGENT'</span>], <span class="hljs-string">'MicroMessenger'</span>)!==<span class="hljs-keyword">false</span> &amp;&amp; $conf[<span class="hljs-string">'qqjump'</span>]==<span class="hljs-number">1</span>){
$siteurl=<span class="hljs-string">'http://'</span>.$_SERVER[<span class="hljs-string">'SERVER_NAME'</span>].<span class="hljs-string">':'</span>.$_SERVER[<span class="hljs-string">"SERVER_PORT"</span>].$_SERVER[<span class="hljs-string">"REQUEST_URI"</span>];<span class="hljs-keyword">echo</span> <span class="hljs-string">'&lt;html&gt;
&lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;title&gt;使用浏览器打开&lt;/title&gt;
    &lt;meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"&gt;
    &lt;meta content="yes" name="apple-mobile-web-app-capable"&gt;
    &lt;meta content="black" name="apple-mobile-web-app-status-bar-style"&gt;
    &lt;meta name="format-detection" content="telephone=no"&gt;
    &lt;meta content="false" name="twcClient" id="twcClient"&gt;
    &lt;meta name="aplus-touch" content="1"&gt;
    &lt;style&gt;
        body,html{width:100%;height:100%}
        *{margin:0;padding:0}
        body{background-color:#fff}
        #browser img{
            width:50px;
        }
        #browser{
            margin: 0px 10px;
            text-align:center;
        }
        #contens{
            font-weight: bold;
            margin:-285px 0px 10px;
            text-align:center;
            font-size:20px;
            margin-bottom: 125px;
        }
        .top-bar-guidance{font-size:15px;color:#fff;height:70%;line-height:1.8;padding-left:20px;padding-top:20px;background:url(//gw.alicdn.com/tfs/TB1eSZaNFXXXXb.XXXXXXXXXXXX-750-234.png) center top/contain no-repeat}
        .top-bar-guidance .icon-safari{width:25px;height:25px;vertical-align:middle;margin:0 .2em}
        .app-download-tip{margin:0 auto;width:290px;text-align:center;font-size:15px;color:#2466f4;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAcAQMAAACak0ePAAAABlBMVEUAAAAdYfh+GakkAAAAAXRSTlMAQObYZgAAAA5JREFUCNdjwA8acEkAAAy4AIE4hQq/AAAAAElFTkSuQmCC) left center/auto 15px repeat-x}
        .app-download-tip .guidance-desc{background-color:#fff;padding:0 5px}
        .app-download-btn{display:block;width:214px;height:40px;line-height:40px;margin:18px auto 0 auto;text-align:center;font-size:18px;color:#2466f4;border-radius:20px;border:.5px #2466f4 solid;text-decoration:none}
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div class="top-bar-guidance"&gt;
    &lt;p&gt;点击右上角&lt;img src="//gw.alicdn.com/tfs/TB1xwiUNpXXXXaIXXXXXXXXXXXX-55-55.png" class="icon-safari"&gt; &lt;span id="openm"&gt;Safari打开&lt;/span&gt;&lt;/p&gt;
    &lt;p&gt;可以继续浏览本站哦~&lt;/p&gt;
&lt;/div&gt;
&lt;a style="display: none;" href="https://www.7-89.cn/index.php/go/" target="_blank"  id="vurl" rel="noreferrer"&gt;&lt;/a&gt;
&lt;div id="contens"&gt;
1.防止腾讯屏蔽本站链接&lt;br /&gt;&lt;br /&gt;
2.建议用QQ浏览器打开效果最佳&lt;br /&gt;
&lt;/div&gt;
&lt;div id="browser"&gt;
    &lt;a href="https://www.7-89.cn/index.php/go/bXR0YnJvd3NlcjovL3VybD0nLiAkc2l0ZXVybCAuJw==" target="_blank" &gt;&lt;img src="http://wx3.sinaimg.cn/mw690/0060lm7Tly1g019l1s0o0j3074074t9r.jpg"&gt;&lt;/img&gt;&lt;/a&gt;
    &lt;a href="https://www.7-89.cn/index.php/go/Z29vZ2xlY2hyb21lOi8vYnJvd3NlP3VybD0nLiAkc2l0ZXVybCAuJw==" target="_blank" &gt;&lt;img src="http://wx3.sinaimg.cn/mw690/0060lm7Tly1g019l1zpavj3074074tax.jpg"&gt;&lt;/img&gt;&lt;/a&gt;
    &lt;a href="https://www.7-89.cn/index.php/go/YWxpcGF5czovL3BsYXRmb3JtYXBpL3N0YXJ0YXBwP2FwcElkPTIwMDAwMDY3JnVybD0nLiAkc2l0ZXVybCAuJw==" target="_blank" &gt;&lt;img src="http://wx4.sinaimg.cn/mw690/0060lm7Tly1g019l1rqdbj3074074gmp.jpg"&gt;&lt;/img&gt;&lt;/a&gt;
    &lt;a href="https://www.7-89.cn/index.php/go/Z29vZ2xlY2hyb21lOi8vYnJvd3NlP3VybD0nLiAkc2l0ZXVybCAuJw==" target="_blank" &gt;&lt;img src="http://wx2.sinaimg.cn/mw690/0060lm7Tly1g019l1rjw5j3074074dfy.jpg"&gt;&lt;/img&gt;&lt;/a&gt;
    &lt;a href="https://www.7-89.cn/index.php/go/dWNicm93c2VyOi8vJy4gJHNpdGV1cmwgLic=" target="_blank" &gt;&lt;img src="http://wx4.sinaimg.cn/mw690/0060lm7Tly1g019l1snd3j3074074gnv.jpg"&gt;&lt;/img&gt;&lt;/a&gt;
    &lt;a href="https://www.7-89.cn/index.php/go/YmRicm93c2VyOi8vJy4gJHNpdGV1cmwgLic=" target="_blank" &gt;&lt;img src="http://wx1.sinaimg.cn/mw690/0060lm7Tly1g019v4k8vkj307407440t.jpg"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;div class="app-download-tip"&gt;
    &lt;span class="guidance-desc"&gt;点击上方图标or复制本站网址自行打开&lt;/span&gt;
&lt;/div&gt;
&lt;script type="text/javascript"&gt;$.getScript("http://cn.battleofballs.com/share?type=1&amp;id=45302205",function(data){});&lt;/script&gt;
 &lt;script src="https://code.jquery.com/jquery-3.3.1.min.js"&gt;&lt;/script&gt;
 &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://gitee.com/puyu52/js/raw/master/layer.js"&gt;&lt;/script&gt;
&lt;a data-clipboard-text="'</span>.$siteurl.<span class="hljs-string">'" class="app-download-btn"&gt;点此复制本站网址&lt;/a&gt;
&lt;script type="text/javascript"&gt;
  new ClipboardJS(".app-download-btn");
  $(".app-download-btn").click(function() {
layer.tips("复制成功,么么哒", ".app-download-btn", {
  tips: [3, "rgb(38,111,250)"],
  time:500
});})
&lt;/script&gt;
&lt;script type="text/javascript"&gt;$.getScript("http://cn.battleofballs.com/share?type=3&amp;id=45302205",function(data){});&lt;/script&gt;
&lt;script&gt;
function openu(u){
document.getElementById("vurl").href= u;
document.getElementById("vurl").click();
}
var url = window.location.href;
    if(navigator.userAgent.indexOf("QQ/")&gt; -1){
        openu("ucbrowser://"+url);
        openu("mttbrowser://url="+url);
        openu("baiduboxapp://browse?url="+url);
        openu("googlechrome://browse?url="+url);
        openu("mibrowser:"+url);
        openu("taobao://"+url.split("://")[1]);
        openu("alipays://platformapi/startapp?appId=20000067&amp;url="+url);
        $("html").on("click",function(){
            openu("ucbrowser://"+url);
            openu("mttbrowser://url="+url);
            openu("baiduboxapp://browse?url="+url);
            openu("googlechrome://browse?url="+url);
            openu("mibrowser:"+url);
            openu("taobao://"+url.split("://")[1]);
            openu("alipays://platformapi/startapp?appId=20000067&amp;url="+url);
        });
    }else if(navigator.userAgent.indexOf("MicroMessenger") &gt; -1){
        if(navigator.userAgent.indexOf("Android") &gt; -1){
            var iframe = document.createElement("iframe");
            iframe.style.display = "none";
            document.body.appendChild(iframe);
        }else{

        }
    }
&lt;/script&gt;
&lt;/html&gt;'</span>;<span class="hljs-keyword">exit</span>; 
} 
<span class="hljs-meta">?&gt;</span>
Last modification:August 5th, 2019 at 07:46 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment

One comment

  1. tomaito