2017-07-02 42 views
0

我已經試過一切如何回顯following,但它不斷給我一個錯誤或它返回空白。如echo $s->following給出錯誤Notice: Undefined property: stdClass::$following。我只想輸出對象數組中的第一個後續內容。代碼對象如下:

object(stdClass)#11 (1) { ["relationship"]=> object(stdClass)#12 (2) { ["source"]=> object(stdClass)#13 (16) { ["id"]=> int(49216720948621475) ["id_str"]=> string(18) "56435616498624156" ["screen_name"]=> string(15) "lmfao" ["following"]=> bool(true) ["followed_by"]=> bool(false) ["live_following"]=> bool(false) ["following_received"]=> NULL ["following_requested"]=> NULL ["notifications_enabled"]=> NULL ["can_dm"]=> bool(false) ["blocking"]=> NULL ["blocked_by"]=> NULL ["muting"]=> NULL ["want_retweets"]=> NULL ["all_replies"]=> NULL ["marked_spam"]=> NULL } ["target"]=> object(stdClass)#14 (7) { ["id"]=> int(53486451354989563589) ["id_str"]=> string(18) "6873168431643435468" ["screen_name"]=> string(10) "sunshine" ["following"]=> bool(false) ["followed_by"]=> bool(true) ["following_received"]=> NULL ["following_requested"]=> NULL } } } 
+1

我認爲是因爲「跟隨」是在「源」裏面,「源」是在「關係」裏面。所以你可以試試看看它是否有效: '$ s-> relationship-> source-> following' –

+0

@Long King我認爲這很有效。它輸出一個1.我猜如果它輸出一個使其爲TRUE正確的1?因爲當它輸出FALSE時,輸出爲空。 – PirateTube

+0

你,1是真的,0是假的 –

回答

1

我認爲是因爲「以下」是在「源」和「源」內部是「關係」內部。所以你可以試試看看它是否有效:$s->relationship->source->following

相關問題