如何在PHP中访问多维关联JS数组值?

时间:2014-04-06 10:56:41

标签: php multidimensional-array

这是我在PHP中收到它的多维关联javascript数组:

array (size=2)
 0 => 
    object(stdClass)[1]
      public 'count' => string '30' (length=2)
      public 'size' => string '1' (length=0)
      public 'name' => string 'aa' (length=0)
      public 'pid' => string '910' (length=0)
      public 'price' => string '300' (length=0)
  1 => 
    object(stdClass)[2]
      public 'count' => string '30' (length=2)
      public 'size' => string '2' (length=0)
      public 'name' => string 'bb' (length=0)
      public 'pid' => string '920' (length=0)
      public 'price' => string '400' (length=0)

如何在PHP中访问多维关联JS数组值?

1 个答案:

答案 0 :(得分:2)

您必须将其用作对象,例如

foreach($array as $obj) echo $obj->count;