The key code is as follows:
//获取微信登录用户信息 function getOpenID($appid,$appsecret,$code){ $url="https://api.weixin.qq.com/sns/oauth2/access_token?appid=".$appid."&secret=". $appsecret."&code=".$code."&grant_type=authorization_code"; $weixin=file_get_contents($url);//通过code换取网页授权access_token $js //对JSON格式的字符串进行编码 $array = get_object_vars($jsondecode);//转换成数组 $openid = $array['openid'];//输出openid return $openid; }
The above is the editor’s introduction to PHP to obtain the user’s openid (key code) through the Code parameter of WeChat jump. I hope it will be helpful to everyone. If you have any questions If you have any questions, please leave me a message and I will reply to you in time. Thank you very much for your support of this website!
The above introduces how PHP obtains the user's openid key code through the Code parameter of WeChat jump, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.