openid 有些用户的能获取到,有些用户的获取不到,为什么?
openid 有些用户的能获取到,有些用户的获取不到,为什么?是用户做了什么设置吗?
4 回复
wx.request({ url: 'https://cash.tosolomo.com/chwl_fz/add_wxuser_json' ,//自己的服务接口地址 method: 'post' , header: { 'content-type' : 'application/x-www-form-urlencoded' }, data: { encryptedData: res.encryptedData, iv: res.iv, code: code }, success: function (data) { that.globalData.uid = data.data; wx.setStorage({ key: "uidkey" , data: data.data, success: function (res) { console.log(data.data) }, }) }, fail: function () { console.log( '系统错误' ) } }) |
include_once "wxaec/wxBizDataCrypt.php" ; $appid = 'wxb85d603c6***' ; $secret = '42c1a3cc9712666af2d60d***5' ; $js_code = trim( $this ->input->post( 'code' )); //$js_code = "001iHwvE0k59Ve28tawE09PbvE0iHwvl"; $encryptedData = trim( $this ->input->post( 'encryptedData' )); $iv = trim( $this ->input->post( 'iv' )); $url = "https: //api.weixin.qq.com/sns/jscode2session?appid= ".$appid." &secret= ".$secret." &js_code= ".$js_code." &grant_type=authorization_code"; $ch = curl_init(); //初始化curl curl_setopt( $ch , CURLOPT_URL, $url ); //抓取指定网页 curl_setopt( $ch , CURLOPT_RETURNTRANSFER, 1); //要求结果为字符串且输出到屏幕上 curl_setopt( $ch , CURLOPT_POST, 1); curl_setopt( $ch , CURLOPT_POSTFIELDS, $post_data ); curl_setopt( $ch , CURLOPT_SSL_VERIFYPEER, false); // 信任任何证书 curl_setopt( $ch , CURLOPT_SSL_VERIFYHOST, 1); // 检查证书中是否设置域名 curl_setopt( $ch , CURLOPT_HEADER, TRUE); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)' ); $wxdata = curl_exec( $ch ); //运行curl curl_close( $ch ); preg_match_all( '/"session_key":"(.*)",/isU' , $wxdata , $rct_array ); |