PHP微信登录流程

1.小城讯调用wx.login得到code

2.小程序调用wx.getUserInfo得到rawDate\signatrue\encryptDate\iv

3.将获取的参数传给服务器进行处理

4.服务器引入文件并获得appid和secret

5.组装接口链接(

https://api.weixin.qq.com/sns/jscode2session?appid={$appid}&secret={$secret}&js_code={$code}&grant_type=authorization_code

6.使用file_get_contents()抓取链接的数据,并对返回的数据进行json_decode解码,转换为PHP变量(获取openid  session_key)

7.引入文件wxBizDataCrypt进行微信登录解密,并对返回的数据进行json_decode解码,转换为PHP变量

8.根据个人需求进行操作

猜你喜欢

转载自blog.csdn.net/hai__yin/article/details/81027760