PHP 代码延时执行后面的代码

//金额小于5W 并且状态=0  支付时间大于15天   更改状态为 1,并转帐到会员余额
$sql1 = "select id,userid,price,payment_time from `" . $dbpre . "auction_record` where price < 5000 and status=0 order by id desc";

$query1 = mysql_query($sql1, $conn);
while ($row1 = mysql_fetch_array($query1)) {
    //判断是否小于5W
    $dqtime = time();//当前时间
    $paytime = $row1['payment_time'];//支付时间
    $payment_time = intval(($dqtime - $paytime) / 24 / 60 / 60);
    if($payment_time > 15){
        sleep(2);
        echo $row1['id'].",";
        ob_flush();
        flush();
    }
}

你可能感兴趣的:(PHP技术)