我的问题是,当我得到例如 15 分钟的持续时间时。数据库中每小时的持续时间,这些值存储在变量中,然后将这些变量传递给 strtotime("+15 minutes") 然后它们会出错。我该如何解决这个问题?
我的代码在这里:
$custom = $book_u['custom_min'] = $row['custom_min'];
$start_time=explode(',',$row['start_time']);
while($t==0)
{
$t=1;
$endTime2 = strtotime("+1".$custom."minutes", strtotime($endTime));
$starts_t[]=date('h:i a', strtotime($endTime));
$ends_t[]=date('h:i a', $endTime2);
//echo date('h:i a', strtotime($endTime)).'-'.date('h:i a', $endTime2).'</br>';
$endTime=date('h:i a', strtotime("+15 mins", $endTime2));
if(strtotime($endTime)>strtotime($finalTime)){
$t=1;
}
else $t=0;
}