关键代码如下所示:
//获取微信登录用户信息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'];//输出openidreturn $openid;}
以上所述是小编给大家介绍的php通过微信跳转的code参数获取用户的openid(关键代码),希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对本站网站的支持!
以上就介绍了 php通过微信跳转的code参数获取用户的openid关键代码,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。