php中的数组如下:
array (size=2)
0 =>
array (size=2)
0 =>
array (size=4)
'id' => int 1
'fid' => int 0
'title' => string '数码1' (length=12)
'level' => int 9
1 =>
array (size=4)
'id' => int 2
'fid' => int 0
'title' => string '数码2' (length=12)
'level' => int 8
1 =>
array (size=2)
0 =>
array (size=4)
'id' => int 11
'fid' => int 1
'title' => string '手机1' (length=12)
'level' => int 0
1 =>
array (size=4)
'id' => int 12
'fid' => int 1
'title' => string '手机2' (length=12)
'level' => int 0
使用json_encode输出如下:
[
[{
"id": 1,
"fid": 0,
"title": "数码1",
"level": 9
}, {
"id": 2,
"fid": 0,
"title": "数码2",
"level": 8
}],
[{
"id": 11,
"fid": 1,
"title": "手机1",
"level": 0
}, {
"id": 12,
"fid": 1,
"title": "手机2",
"level": 0
}]
]
想要的格式是:
"0": [{
"id": 1,
"fid": 0,
"title": "数码1",
"level": 9
}, {
"id": 2,
"fid": 0,
"title": "数码2",
"level": 8
}],
"1": [{
"id": 11,
"fid": 1,
"title": "手机1",
"level": 0
}, {
"id": 12,
"fid": 1,
"title": "手机2",
"level": 0
}]
至尊宝的传说