微信公众平台开发 获取的用户基本信息如何存入mysql数据库
string(390)"{"subscribe":1,"openid":"ouBMEj6WFnUFBIUKe83VD7s6dft8","nickname":"简单的幸福。...
string(390) "{"subscribe":1,"openid":"ouBMEj6WFnUFBIUKe83VD7s6dft8","nickname":"简单的幸福。","sex":2,"language":"zh_CN","city":"唐山","province":"河北","country":"中国","headimgurl":"http:\/\/wx.qlogo.cn\/mmopen\/mONcle9pic3ypGdtTcTmgwkG2u5BFFmnAQ92X7EiajLjPy7Dvwib9wuG9EFo6GGibHWzPJYZNKXZ79BUicqadAs0ZT4ibicAQCc999g\/0","subscribe_time":1375706487,"unionid":"oTBn-jt2RQSHdBoJQYFSdnZo8BBQ"}"
很感谢rainling2008的回答,我用的是thinkphp 展开
很感谢rainling2008的回答,我用的是thinkphp 展开
展开全部
使用java吗,那你先需要按微信返回给你数据格式创建一个微信用户对象
我这有现成的,然后根据该类里的字段进行保存就行了
/**
* 微信用户信息模型
* <p>
* Author: Shulei Ling
* <p>
* Date:2014年4月17日 Time:下午1:21:22
* <p>
*/
public class WxUser implements Serializable
{
/**
*
*/
private static final long serialVersionUID = 2454542358870962981L;
private int subscribe;
private String openid;
private String nickname;
private int sex;
private String language;
private String city;
private String province;
private String country;
private String headimgurl;
private Long subscribe_time;
public int getSubscribe()
{
return subscribe;
}
public void setSubscribe(int subscribe)
{
this.subscribe = subscribe;
}
public String getOpenid()
{
return openid;
}
public void setOpenid(String openid)
{
this.openid = openid;
}
public String getNickname()
{
return nickname;
}
public void setNickname(String nickname)
{
this.nickname = nickname;
}
public int getSex()
{
return sex;
}
public void setSex(int sex)
{
this.sex = sex;
}
public String getLanguage()
{
return language;
}
public void setLanguage(String language)
{
this.language = language;
}
public String getCity()
{
return city;
}
public void setCity(String city)
{
this.city = city;
}
public String getProvince()
{
return province;
}
public void setProvince(String province)
{
this.province = province;
}
public String getCountry()
{
return country;
}
public void setCountry(String country)
{
this.country = country;
}
public String getHeadimgurl()
{
return headimgurl;
}
public void setHeadimgurl(String headimgurl)
{
this.headimgurl = headimgurl;
}
public Long getSubscribe_time()
{
return subscribe_time;
}
public void setSubscribe_time(Long subscribe_time)
{
this.subscribe_time = subscribe_time;
}
}
我这有现成的,然后根据该类里的字段进行保存就行了
/**
* 微信用户信息模型
* <p>
* Author: Shulei Ling
* <p>
* Date:2014年4月17日 Time:下午1:21:22
* <p>
*/
public class WxUser implements Serializable
{
/**
*
*/
private static final long serialVersionUID = 2454542358870962981L;
private int subscribe;
private String openid;
private String nickname;
private int sex;
private String language;
private String city;
private String province;
private String country;
private String headimgurl;
private Long subscribe_time;
public int getSubscribe()
{
return subscribe;
}
public void setSubscribe(int subscribe)
{
this.subscribe = subscribe;
}
public String getOpenid()
{
return openid;
}
public void setOpenid(String openid)
{
this.openid = openid;
}
public String getNickname()
{
return nickname;
}
public void setNickname(String nickname)
{
this.nickname = nickname;
}
public int getSex()
{
return sex;
}
public void setSex(int sex)
{
this.sex = sex;
}
public String getLanguage()
{
return language;
}
public void setLanguage(String language)
{
this.language = language;
}
public String getCity()
{
return city;
}
public void setCity(String city)
{
this.city = city;
}
public String getProvince()
{
return province;
}
public void setProvince(String province)
{
this.province = province;
}
public String getCountry()
{
return country;
}
public void setCountry(String country)
{
this.country = country;
}
public String getHeadimgurl()
{
return headimgurl;
}
public void setHeadimgurl(String headimgurl)
{
this.headimgurl = headimgurl;
}
public Long getSubscribe_time()
{
return subscribe_time;
}
public void setSubscribe_time(Long subscribe_time)
{
this.subscribe_time = subscribe_time;
}
}
追问
谢谢,是thinkphp的,你会吗
追答
不会 不过思想是一样的
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询