希望大神们参考做个插件
header("location:http://code.test.com/code.php?ask_type=www");
header("location:http://code.test.com/code.php?ask_type=bbs");
code_php : 发起授权文件
bbs.php : 返回接收code并跳转 http://bbs.test.com文件
if(isset($_GET['ask_type']) && !empty($_GET['ask_type'])){ $ask_type = $_GET['ask_type']; if($ask_type == 'bbs'){ $action = "bbs.php"; }elseif($ask_type == 'www'){ $action = "www.php"; } //发起授权 $appid = ""; $redirect_url = "http://code.test.com/".$action; $code_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$appid."&redirect_uri=".urlencode($redirect_url)."&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"; header("location: ".$code_url); die;}else{ echo "nononono";}
if(isset($_GET['code']) && !empty($_GET['code'])){ $code = $_GET['code']; $bbs = "http://bbs.test.com/"; header("location:".$bbs."?code=".$code);}else{ echo 'nonono';}
if(isset($_GET['code']) && !empty($_GET['code'])){ $code = $_GET['code']; $bbs = "http://www.test.com/"; header("location:".$bbs."?code=".$code);}else{ echo 'nonono';}