项目数组转换为对象列表:
[ Object {
id=0,
label="Myriel",
group=1
},
Object {
id=1,
label="Napoleon",
group=1},
....
....
]
使用php创建对象列表
答案 0 :(得分:1)
这样的东西?
<?php
$Objects = array(
'one' => array(
'Id' => '0',
'Label' => 'Myriel',
'Group' => '1'
),
'two' => array(
'Id' => '1',
'Label' => 'Napoleon',
'Group' => '1'
)
);
$R = json_decode(json_encode($Objects));
echo $R->one->Label; //Would show Myriel