dongquanlin1885 2012-03-29 10:40
浏览 44
已采纳

如何解析和显示评论

Help, my mind is going crazy. How do I parse the comment and display it.

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
    )

)
  • 写回答

1条回答 默认 最新

  • duanjiongzhen2523 2012-03-29 10:47
    关注

    you got the whole list of objects in comments so give try following:

    foreach( $yourObj->stream->comments as $comment){
       echo sprintf('%s: %s', $comment->from->name, $comment->message);
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器