PHP 只能在微信打开

来源: www.luyouqiwo.com| 2017-12-07 15:57
<?php
header("Content-type: text/html; charset=utf-8");
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if (strpos($user_agent, 'MicroMessenger') === false) {
echo "<script>location.href='weixin://dl/business/?ticket=t6baf8f945bf29b5e770d9a8141685fbd#wechat_redirect';</script>";exit;
} else {
session_start();
}
?>

function is_weixin(){
            var ua = navigator.userAgent.toLowerCase();
            if(ua.match(/MicroMessenger/i)=="micromessenger") {
                return true;
             } else {
                return false;
            }
        }
        
        if (!is_weixin()) {
            window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxdf3f22ebfe96b912&redirect_uri=xxx&response_type=code&scope=snsapi_base&state=hyxt#wechat_redirect';
        }

猜你喜欢
推荐
随机推荐
相关文档
月排行文档
Top