使用php创建对象列表


Create object list using php

转换为对象列表的项数组:

[ Object {
          id=0,
          label="Myriel",
          group=1
          },
 Object  { 
         id=1,
         label="Napoleon",
         group=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