标签:pre mobile HERE reac car 拉取 微信 微信公众平台开发 this
1. SDK接口定义
//拉取会员信息接口 public function get_membercard_userinfo($msg) { $url = "https://api.weixin.qq.com/card/membercard/userinfo/get?access_token=".$this->access_token; $res = $this->http_request($url, json_encode($msg)); return json_decode($res, true); }
2. 接收事件submit_membercard_user_info
case "submit_membercard_user_info": $msg = array(‘code‘ => strval($object->UserCardCode), ‘card_id‘ => strval($object->CardId) ); $content = $weixin->get_membercard_userinfo($msg); $data = array(); foreach ($content[‘user_info‘][‘common_field_list‘] as &$item) { if ($item[‘name‘] == "USER_FORM_INFO_FLAG_MOBILE"){ $data[‘mobile‘] = $item["value"]; } if ($item[‘name‘] == "USER_FORM_INFO_FLAG_NAME"){ $data[‘surname‘] = $item["value"]; } } $User->where("`openid` = ‘".$openid."‘")->save($data); break;
标签:pre mobile HERE reac car 拉取 微信 微信公众平台开发 this
原文地址:https://www.cnblogs.com/txw1958/p/weixin-get-user-mobile-name.html