1
我試圖獲得在Twitter上搜索術語並迄今沒有運氣的用戶列表。這裏是我的代碼:Twitter OAuth - 從數組中獲取值
$parameters = array('q' => '#puppy', 'count' => 2);
$results = $connection->get('search/tweets', $parameters);
//print_r($result);
foreach ($results as $data) {
?>
<div id="update">
<div id="left"><a href="https://twitter.com/#!/<?php echo $data->user->screen_name; ?>" target="_blank"/><img width="48px" height="48px" src="<?php echo $data->user->profile_image_url; ?>"/></a></div>
<div id="right">
<div class="user"><a href="https://twitter.com/#!/<?php echo $data->user->screen_name; ?>" target="_blank"/><?php echo $data->user->screen_name; ?></a> <?php echo $data->user->name; ?></div>
<div class="detail">
<?php echo $data->text; ?>
</div>
</div>
</div>
<?php
}
,這就是它輸出:
Notice: Undefined property: stdClass::$user in line 150
Trying to get property of non-object in line 150
我知道我在訪問數組中的一個奇怪的方式,我只是無法弄清楚它是如何必須。
謝謝!有用! – Branislav