// 相关设置
$APPID = "";
$AppSecret = "";
$html = "";
// 拼接 URL
// 跳转该连接 获取 CODE
$url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=$APPID&redirect_uri=$html&response_type=code&scope=snsapi_userinfo#wechat_redirect";
$code = ""; //获取上一步得到的 CODE
$get_token_url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=$APPID&secret=$AppSecret&code=$code&grant_type=authorization_code";
$ACCESS_TOKEN = "";// 获取上一步得到的 ACCESS_TOKEN
$OPENID = ""; // 每个用户都有唯一的一个 OPENID
//获取用户信息
$get_user_info_url = "https://api.weixin.qq.com/sns/userinfo?access_token=$ACCESS_TOKEN&openid=$OPENID&lang=zh_CN";
$get_user_info = file_get_contents($get_user_info_url);
$get_user_info = json_decode($get_user_info);
获取更多详情