我有一个Facebook图形API请求,它带回此响应

Facebook\GraphObject Object
(
    [backingData:protected] => Array
        (
            [data] => Array
                    (
                        [0] => stdClass Object
                            (
                                [id] => 111
                                [from] => stdClass Object
                                    (
                                        [id] => 111
                                        [name] => fo bar
                                    )

                                [name] => etc

                            )

我试着做$reponse->{'backingData:protected'},但没有用。

同样,下一组结果是到图形api的链接,但是来自此的结果是纯json。
    [paging] => stdClass Object
        (
            [cursors] => stdClass Object
                (
                    [after] => MTI3NzMzMTQwMzYy
                    [before] => MTAxNTQzNjI5NTY1NDAzNjM=
                )

            [next] => https://graph.facebook.com/v2.0/111/albums?access_token=xxxxv&limit=25&after=yyy
        )

我的密码
    $user_profile = (new FacebookRequest(
        $session, 'GET', '/me/albums'
    ))->execute()->getGraphObject();

    echo '<pre>'; print_r($user_profile); echo '</pre>';

最佳答案

方法如下:

        $user_profile = (new FacebookRequest(
        $session, 'GET', '/me/albums'
        ))->execute()->getGraphObject();
        $album =  $user_profile->getProperty('data');

        $album_data = $album->asArray();//this will do all job for you..
        foreach($album_data as $row){
            var_dump($row);
        }

10-06 13:03