一、 微信小程序授权登录
1. 小程序获取用户code
2. 服务端根据code获取用户openid
/*
请求参数
参数 必填 说明
appid 是 小程序唯一标识
secret 是 小程序的 app secret
js_code 是 登录时获取的 code
grant_type 是 填写为 authorization_code
返回参数
参数 说明
openid 用户唯一标识
session_key 会话密钥
expires_in 过期时长(默认7200)
*/
$host = 'https://api.weixin.qq.com/sns/jscode2session?';
$appid = $this->config->get('config_wx_xcx_appid');
$secret = $this->config->get('config_wx_xcx_appsecret');
$grant_type = 'authorization_code';
$arr = array(
'appid' => $appid,
'secret' => $secret,