wx.request 的参数为josn数组时,服务端接收到的数据格式无法还原为josn格式。吐血。
josn格式:
dataSubmit[“taskArr”] = [{1:1},{1:2},{1:3}];
调用方式:
wx.request({
url: app.globalData.host + ‘/XP200-Task-Create/submitTrip.html’,
header: {“Content-Type”:“application/x-www-form-urlencoded” }, method :‘POST’,
data: dataSubmit,
success: function(res) {
console.log(res.data);
wx.showToast({ title: ‘提交成功’, icon: ‘success’, });
}
})
服务端的结果为:
array (
‘xxModify’ => ‘i’,
‘task_title’ => ‘aaaaaaa’,
‘taskArr’ => ‘[object Object],[object Object],[object Object]’,
)