关于一个请求的问题
谁能帮我看下的代码问题吗
微信端:
pay: function () {
var token = wx.getStorageSync('token');
var that = this;
var jsond;
wx.request({
url: 'http://zerg.me/api/v1/order?XDEBUG_SESSION_START=1757',
header: {
"token": token,
"content-type": "application/x-www-form-urlencoded"
},
data: {
products: [
{
"product_id": 1, "count": 1
},
{
"product_id": '1', "count": 1
}
]
},
method: 'POST',
success: function (res) {
console.log(res.data);
}
})
},
服务器端 :
// print_r( json_decode($_POST['products'],true) );
print_r($_POST);
die;
为什么会输出 、
Array
(
[products] => [object Object],[object Object]
)
当我用ajax请求的时候就能正确输出出来
Array ( [products] => Array ( [0] => Array ( [product_id] => 1 [count] => 1 ) [1] => Array ( [product_id] => 1 [count] => 1 ) ) )
请问原因是什么