我有此入住时间和预订系统中的退房时间。确认后,我希望所选时间在时间旁边添加一个单词“ booked”。例如10:00至14:00,它将显示为已预订。
00:00
01:00
02:00
03:00
04:00
05:00
06:00
07:00
08:00
09:00
10:00 booked
11:00 booked
12:00 booked
13:00 booked
14:00 booked
15:00
16:00
17:00
18:00
19:00
20:00
21:00
22:00
23:00
我已经在脚本中得到了上面的内容,使用json_encode保存到数据库后,这就是输出
["00:00","1:00","2:00","3:00","4:00","5:00","6:00","7:00","8:00","9:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"]
预订的单词不在
中"10:00-Booked","11:00 -Booked","12:00-booked","13:00-booked","14:00-booked"
这是我的下面的脚本
$checkTime = $confirmAdmin['checkin_time'];
$checkOut = $confirmAdmin['checkout_time'];
$checkTimeExp = explode(":",$checkTime);
$checkOutExp = explode(":",$checkOut);
$tues = json_decode($room['day_tuesday']);
$tArray = array();
foreach($tues as $key=>$tue){
echo "<br>";
$n = $checkOutExp[0];
$items = range($checkTimeExp[0],$n);
$sum = array_sum($items);
foreach($items as $key=>$item){
$tt = $item;
if($tt == $tue){
$booked = "booked";
echo $booked;
}
}
echo $tArray[] = $tue;
}
echo json_encode($tArray);
我的json_encode
的输出是没有预订的单词。