Json解码数组

时间:2011-04-04 07:36:57

标签: php arrays json

我有,

Hypertable_ThriftGen_HqlResult Object
(
  [results] => 
   [cells] => Array
      (
       [0] => Hypertable_ThriftGen_Cell Object
               (
                   [key] => Hypertable_ThriftGen_Key Object
                      (
                       [row] => abc.com
                            [column_family] => domain_name
                           [column_qualifier] => 
                         [timestamp] => 1.30189374164E+18
                         [revision] => 1.30189374164E+18
                           [flag] => 255
                        )
 [value] => www.abc.com
                )
)

如何检索每个单独的值?

它似乎是一个json解码数组,但不确定。

1 个答案:

答案 0 :(得分:2)

你有一个对象,你可以像迭代数组一样迭代它

foreach($yourobject->cells as $rows){
    foreach($rows as $row){
        print_r($row->key);
    }
}