whileの中で「$tameru_tutor = array();」とやっているので、毎回初期化している感じですね。
whileの外に出してしまえばいいのでは?
ご回答、ありがとうございます。具体的にはどんなプログラムになりますでしょうか?
▽2
●
tobeoscontinue ●150ポイント ベストアンサー |
$cursor = -1; $tameru_tutor = array(); while($cursor != 0){ $vRequest_tutor = $twObj_tutor->OAuthRequest("https://api.twitter.com/1.1/followers/list.json","GET",array('screen_name' => 'XXXX','cursor' => $cursor,'skip_status' => 'true','include_user_entities' => 'false' )); $temp = json_decode($vRequest_tutor,true); if (isset($temp['next_cursor_str'])) { $cursor = $temp['next_cursor_str']; $tameru_tutor[] = $temp; unset($temp); } else { $cursor = "0"; } }//end of while
$tameru_tutorは二次元のような感じになりますので
foreach ($tameru_tutor as $temp) {
foreach ($temp["users"]) as $user) {
echo $user["name"];
}
}
或いは$temp["users"]だけでよいのであれば
$tameru_tutor[] = $temp;
を
$tameru_tutor = array_merge($tameru_tutor, $temp["users"]);
とすれば
foreach ($tameru_tutor as $user) {
echo $user["name"];
}
でアクセスできると思います。