$cursor = -1;
$limit = 5;
while($cursor != 0){
$parameters = array('screen_name' => $q, 'cursor' => $cursor , 'count' => $limit);
$method = "followers/ids";
$response2 = $connection->get($method, $parameters);
$followerlist = array_merge($followerlist,$response2->ids);
$cursor = $response2->next_cursor;
}
我做了 5 个限制,但它给了我所有关注者 ID......如果用户有 20 个关注者,它会给我 20 个 ID,但我只需要 5 个。我给出了一个计数参数 5,但它似乎忽略了它。我做错了什么?
如果你一次只需要 5 个结果,就不需要 while 循环。只需指定'count' => 5