我下面有一个 PHP 循环,它工作正常,但有时 CURL 请求会返回一个错误页面,如何才能仅重新启动当前页面的操作而不重新启动整个循环?
while ($daytofetch <= $lastdaytofetch) {
//Do all my stuff and run curl request here
$daytofetch++
}
最佳答案
while ($daytofetch <= $lastdaytofetch) {
// Do all my stuff and run curl request here
if ($error_detected) {
// This will resume the loop without incrementing
// $daystofetch
continue;
}
$daytofetch++
}
关于php - 当检测到错误时重新启动 while 循环的当前操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14347171/