0
Array
(
    [0] => stdClass Object
        (
            [href] => http://www.google.com
            [description] => search
            [extended] => 
            [meta] => x
            [hash] => x
            [time] => 2013-04-09T02:00:57Z
            [shared] => yes
            [toread] => no
            [tags] => 
        )

    [1] => stdClass Object
        (
            [href] => http://shop.frankchimero.com/collections/frontpage/products/the-shape-of-design-digital-preorder
            [description] => 
            [extended] => 
            [meta] => x
            [hash] => x
            [time] => 2013-04-06T19:39:51Z
            [shared] => yes
            [toread] => no
            [tags] => 
        )

我有一个这样的数组,但我不知道如何解析它。我该怎么做,“foreach 0, 1, 2, 3, etc. get href”?

4

3 回答 3

2

与选项 TRUE 一起使用json_decode以将结果集作为数组返回,然后循环遍历数组。

$data = json_decode($my_array, TRUE);

foreach($data as $info) {
  echo $info['href'];
  echo $info['time'];
  //etc..
}
于 2013-04-10T16:39:15.010 回答
0
foreach ($jsonPages as $page)
{
    var_dump($page->href);
}
于 2013-04-10T16:39:03.197 回答
0

你可以做

foreach($yourJSONArrayName as $jsonObject)
{
  echo $jsonObject->href;   //etc
//print_r($jsonObject);   
}
于 2013-04-10T16:38:17.087 回答