来自 PHP Twitter API 的 JSON 调用


json call from php twitter api

$content = $connection->get('statuses/public_timeline');

.当我在我的 php 文件中使用此片段时。我想从如下所示的结果数组中回显 $content[0].text:

Array
(
[0] => stdClass Object
    (
        [in_reply_to_user_id_str] => 
        [coordinates] => 
        [geo] => 
        [user] => stdClass Object
            (
                [profile_sidebar_border_color] => a166d9
                [followers_count] => 40
                ...
            )
        [truncated] => 
        [text] => some dump text
        ...
    )
...
 )

我将如何访问 [文本] 或 [profile_sidebar_border_color]。PHP 语法是什么?我应该解码吗?

你想要

$content[0]->text 

对于文本和

$content[0]->user->profile_sidebar_border_color

对于用户的个人资料边栏边框颜色