微信跳转


if(strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') == true){

        if (!isset($_GET['code'])) {

            $baseurl=urlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"]."/weixin.php?backurl=".$_GET['redirect_uri']);

            $url='https://open.weixin.qq.com/connect/oauth2/authorize?appid='.$_GET['appid'].'&redirect_uri='.$baseurl.'&response_type=code&state='.$_GET['state'].'&scope=snsapi_userinfo#wechat_redirect';

            header("Location: ".$url);

            exit;

        }else{

            header("Location: ".$_GET['redirect_uri'].'?code='.$_GET['code'].'&state='.$_GET['state'].'&appid='.$_GET['appid'].'&scope='.$_GET['scope']);

            exit;

        }

}else{

    echo '请用微信打开!';

    exit;

}



评论0



    0.415384s