Oauth.php文件关键代码:
if (isset($_GET['code'])){
echo $_GET['code'];
}else{
echo "NO CODE";
}
获取到CODE
********************************************************************************************************
通过以下URL,跳转到回调地址,并获取到CODE
https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxcfd391f718a&redirect_uri=http://154.8.229.242/wx/Oauth.php&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect
通过CODE获取到access_token和OPENID
https://api.weixin.qq.com/sns/oauth2/access_token?appid=wxcfd391fcfa&secret=f86c43bb508146a990a3d12&code=081dc0cO1KO7l91L4ndO1a0bcO1dc0cr&grant_type=authorization_code
通过OPENID和access_token获取用户信息
https://api.weixin.qq.com/sns/userinfo?access_token=16_RBlc7xCSdihkNswzuT3Q5yR_YyersSY4Pqy6UE7hwx2R1z-gn4mtav9hkl9u0iA3DHpwA3xoA4f6-pZj2iEd1myTpSjIrVc&openid=oMd3C0rKgOxvz4zHkPmhfUU-WTpM
********************************************************************************************************