如何在php中获取数组对象的对象

时间:2015-12-11 13:53:32

标签: php arrays

我有一个如下所示的数组

stdClass Object
(
    [1] => stdClass Object
        (
            [title] => 
            [description] =>
        )
)

如何在php中获取描述字段

1 个答案:

答案 0 :(得分:0)

像这样:

foreach($parentObject as $childObject){
   echo $childObject->description;
   //or $childObject['description'] if childObject is array
}