突然,代码中没有任何更改,以下部分在无限循环中运行(在两年多的时间里,它运行得非常好):
$date = date("d.m.Y l", strtotime($supplyDate));
$end = date("d.m.Y l",strtotime("+1 months"));
if(!empty($date_dif)) {
$i = 1;
// PATCH one day minus
$date = date("d.m.Y l", strtotime($date)-(86400));
while (strtotime($date)<strtotime($end)) {
$date = date("d.m.Y l", strtotime($date)+(86400));
$day = date("l", strtotime($date));
if($day == "Saturday" && (intval($isSaturdayOpen) == 0 && intval($date_dif) == 1)){ continue;}
if($day == "Sunday" && (intval($isSundayOpen) == 0 && intval($date_dif) == 1)){ continue;}
$tab_content .= '<option value="'.strtotime($date).'">'.utf8_encode(strftime('%d.%m.%Y %A',strtotime($date))).'</option>';
$i++;
if($i==10){
break;
}
}
}发布于 2015-10-14 02:23:11
虽然很奇怪,但你可以在代码末尾使用一个技巧:
if((int)$i===10){
break; /* You could also write 'break 1;' here. */
}只是以防万一,如果$i不能被类型识别,你可以像整数一样转换并与整数进行比较。
我在这里找不到其他问题。
https://stackoverflow.com/questions/33109758
复制相似问题