微信小程序wx.request的两种传输方式,一种是get方法,一种是Post方法,在使用post传输中文参数时,会遇到在后台接收到的是乱码的情况,这里需要把header修改为:
'content-type':'application/x-www-form-urlencoded;charset=utf-8',
wx.request({ url: config.api.reqSubZhengShu, data: { "zsname": usname, "bhao": bhao, "imgs": imagelists.join("|"), "sessionKey": sessionKey, "uid":uid, "nickName":"中文测试" }, method:"POST", header: { //'content-type': "application/x-www-form-urlencoded" // 默认值 'content-type':'application/x-www-form-urlencoded;charset=utf-8', //'content-type': 'application/json' },