我想为facebook fql json输出相册中的每个项目制作一个变量。这是我进行json编码后的输出。
stdClass Object (
[data] => Array (
[0] => stdClass Object ( [name] => Mobile Uploads )
[1] => stdClass Object ( [name] => Wall Photos )
[2] => stdClass Object ( [name] => Wall Photos )
[3] => stdClass Object ( [name] => New Deck and Patio - DIY )
[4] => stdClass Object ( [name] => New Deck - DIY! )
[5] => stdClass Object ( [name] => Honeymoon )
[6] => stdClass Object ( [name] => 5/5/2012 )
[7] => stdClass Object ( [name] => Cover Photos )
[8] => stdClass Object ( [name] => Profile Pictures )
[9] => stdClass Object ( [name] => Wedding Shower )
[10] => stdClass Object ( [name] => Kuczer Christmas 2011 )
[11] => stdClass Object ( [name] => A Breed Apart studio recording )
[12] => stdClass Object ( [name] => New recessed lighting Kitchen )
[13] => stdClass Object ( [name] => March 10, 2011 Our Engagement )
[14] => stdClass Object ( [name] => Renovated Dining Room )
[15] => stdClass Object ( [name] => Christmas 2010 )
[16] => stdClass Object ( [name] => Florida Trip 2010 )
[17] => stdClass Object ( [name] => MINE )
[18] => stdClass Object ( [name] => Me )
[19] => stdClass Object ( [name] => 2010 FJ Cruiser )
[20] => stdClass Object ( [name] => Family )
[21] => stdClass Object ( [name] => Studio Drums )
[22] => stdClass Object ( [name] => Work )
[23] => stdClass Object ( [name] => A Breed Apart )
[24] => stdClass Object ( [name] => Dirt Biking )
)
)
我想制作每个相册名称的变量,例如$ variable1 =“Florida Trip 2010”等...
答案 0 :(得分:0)
假设您使用print_r($fb_result)
生成上述输出,您可以使用$variable1 = $fb_result->data[16]->name
设置$variable1 = "Florida Trip 2010"
;