跳到主要内容

冗余

重试

<?php

$maxRetries = 3;
$retryInterval = 1;
$retryCount = 0;

do {
$retryCount++;

if ($retryCount !== 1) {
sleep($retryInterval);
}

// 逻辑
$rand = rand(1, 10);
echo $rand.PHP_EOL;
} while ($rand < 9 && $retryCount < $maxRetries);