我使用的脚本有问题。如果 $addcount 不起作用。当我不想要它时,它会继续触发 insertMessage 函数。任何想法为什么?
if(($result->data != '') && ($result->data != null)) {
$wallCount = 0;
$addCount = 0;
foreach($result->data as $thread){
$wallCount++;
$fromId = $thread->from->id;
$message = $thread;
if($fromId == $user['Id']){
if($addCount < 100) {
insertMessage($user['Id'], $message, $user['Num']);
$addCount++;
sleep(1);
}
}
}
}