From a2ec9829ae6f25edcb60681a897cdced0dac4fac Mon Sep 17 00:00:00 2001 From: qingshanking Date: Sun, 25 Nov 2018 16:54:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BB=A3=E7=A0=81=20?= =?UTF-8?q?=E7=89=88=E6=9C=AC=EF=BC=9Av0.2.18.11.25?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 index.php diff --git a/index.php b/index.php new file mode 100644 index 0000000..f9332a8 --- /dev/null +++ b/index.php @@ -0,0 +1,45 @@ +errmsg; +if($state == "ok"){//判断当前获取数据是否成功 + //获取access_token值 + $access_token = $access_token_json->access_token; + //根据access_token和之前转入的UserId(邮箱帐号)拼凑请求地址 + $login_url='https://api.exmail.qq.com/cgi-bin/service/get_login_url?access_token='.$access_token.'&userid='.$mail; + //将请求后的数据转化为Json + $login_url_json = json_decode(file_get_contents($login_url)); + //判断状态 跟第一步请求一样 成功后,会在返回的数据中返回 Ok + if($login_url_json->errmsg=="ok"){ + //成功后,之间跳转到接口返回的地址 即可成功,第一次登陆 有一个验证 验证完成就可以正常使用了。 + header("location:".$login_url_json->login_url); + } + else{ + echo "获取登录地址失败"; + } +}else{ + echo "获取access_token失败!"; +} +?>