我编写了一个PHP脚本来使用APNS推送通知。我添加了一个PHP进度条来监视已经推送了多少用户。进度条显示在PHP页面中。我也不断更新一个MySOL数据库来记录这个数字。预计该脚本将运行很长时间。运行约3小时后,PHP页面(带进度条)停止,但是当我检查数据库时,推送的用户数量仍在增加。这意味着脚本仍在服务器内存中运行,但为什么页面显示停止?PHP脚本仍在服务器上运行,但网页显示已停止
这里是一些代码:
$count = 1;
while($row = mysql_fetch_array($result)) {
$pushToken = $row['pushToken'];
$result2 = mysql_query("SELECT COUNT(*) FROM deactivated_pushtokens WHERE pushToken LIKE '$pushToken'");
list($token_deactivated) = mysql_fetch_row($result2);
if ($token_deactivated==0){
if ($row['pushToken']!=""){
if (strlen($row['pushToken']) == 64){//All valid push tokens will have a 32x2=64 length
//echo "<br>$count. Sending push to ".$row['deviceID']." Device token = ".$row['pushToken'];
//echo "<br><br>";
if($count > $sendThreshold)
{
$pushMessage->sendMessage($row['pushToken'],$count,$appVersion,$mode,$message, $push_id);
}
if($count >= $push_update_count * $push_update_interval)
{
$pushlog_update = mysql_query("UPDATE pushlogs SET num_push_sent = '".$count."' WHERE push_id = '".$push_id."'");
if(!$pushlog_update)
{
// echo "pushlog table update error: ".mysql_error."<br />";
}
/* if($count<=$maxBar) // if failed again commment out and use block bleow
{
$prb->moveStep($count);
}
*/
$push_update_count++;
}
if($count >= $update_progressbar_count * $update_progressbar_interval)
{
if($count<=$maxBar)
{
$prb->moveStep($count);
}
$update_progressbar_interval++;
}
$count++;
// move the Bar
你能显示一些代码吗? – someone