如何访问对象数据并显示注释


How to access object data and display the comments

如何访问注释并显示它们?

stdClass Object
(
[stream] => stdClass Object
    (
        [id] => 521734635_403433313001586
        [from] => stdClass Object
            (
                [name] => Jonathan Rosario
                [id] => 521734635
            )
        [message] => What if we do the same action in our country?...i just hope they be fair. Its just unfair that they also ban our Bibles while we never ban their Qu'rans in our country.
        [comments] => stdClass Object
            (
                [data] => Array
                    (
                        [0] => stdClass Object
                            (
                                [id] => 521734635_403433313001586_90696065
                                [from] => stdClass Object
                                    (
                                        [name] => ''
                                        [id] => 570761262
                                    )
                                [message] => test
                                [created_time] => 2012-03-29T10:01:49+0000
                            )
                        [1] => stdClass Object
                            (
                                [id] => 521734635_403433313001586_90696070
                                [from] => stdClass Object
                                    (
                                        [name] => Alwaynne Kevin
                                        [id] => 100000364267158
                                    )
                                [message] => Oo nga...bakit ganyan sila...hahah.!
                                [created_time] => 2012-03-29T10:07:52+0000
                            )
                        [2] => stdClass Object
                            (
                                [id] => 521734635_403433313001586_90696146
                                [from] => stdClass Object
                                    (
                                        [name] => Jp Peña
                                        [id] => 100000599584313
                                    )
                                [message] => they're just doing what the "christian" crusaders did to them.
                                [created_time] => 2012-03-29T10:33:12+0000
                            )
                    )
                [count] => 3
            )
        [picture] => http://external.ak.fbcdn.net/safe_image.php?d=AQCr7a57qDUU2MHR&w=90&h=90&url=http%3A%2F%2Fwww.interaksyon.com%2Fassets%2Fimages%2Farticles%2Finterphoto_1332546902.jpg
        [name] => Top Saudi cleric 'issues fatwa' on Christian churches; Bishops alarmed - InterAksyon.com
        [description] => Christian bishops are sharply criticizing Saudi Arabia's top religious official after reports that he issued a fatwa saying all churches on the Arabian Peninsula should be destroyed. At least 3.5 million Christians live in the Gulf Arab region. They are mostly Catholic workers from the Philippines a...
        [created_time] => 2012-03-29T10:00:41+0000
    )
)

您在注释中获得了完整的对象列表,因此请尝试以下操作:

foreach( $yourObj->stream->comments as $comment){
   echo sprintf('%s: %s', $comment->from->name, $comment->message);
}