-1
我需要创建一个函数接收一个变量并将其作为json发送。我预计JSON输出是:我需要发送这个变量在PHP
{ "item": [
{
"a": "string",
"b": "string",
"c": 0
}],
"country": 0
}
这是我在PHP函数:
$postData['item'] =
array(
'a' => "12345",
'b' => "98765",
'c' => 0000,
);
$postData['country']= 1;
这产生:
<pre>
array(2) {
['item'] => array(1) {
['sn'] => string(13) '9597/08639650'
}
['country'] => int(717808)
}
</pre>
我也越来越其中指出的错误: ["item is not of a type(s) array"]
我在这里做错了什么?
Regards