这是我想要的输出:
例如,今天是星期一20日 - 星期四23日,所以下一个可用日期将是星期二4日。 所以我的输出应该是:
<input type="checkbox" class="colour-button1" value="10 - 12" id="btn1" disabled/><label for="btn1" style="position:relative;"><i class="fa fa-check-circle fa-lg hide11" id="chk-btn1"></i> Tuesday, March 28</label>
<br><br>
<input type="checkbox" class="colour-button1" value="10 - 12" id="btn2" disabled /><label for="btn2" class="labe1" style="position:relative;"><i class="fa fa-check-circle fa-lg hide11" id="chk-btn2"></i> Thursday,March 30th</label>
<br><br>
<input type="checkbox" class="colour-button1" value="10 - 12" id="btn3" disabled/><label for="btn3" style="position:relative;"><i class="fa fa-check-circle fa-lg hide11" id="chk-btn3"></i> Tuesday, April 4th</label>
<br><br>
<input type="checkbox" class="colour-button1" value="10 - 12" id="btn4" disabled/><label for="btn4" class="labe1" style="position:relative;"><i class="fa fa-check-circle fa-lg hide11" id="chk-btn4"></i> Thursday, April 6th</label>
如果是24日星期日26日星期五,则下一个可用日期是4月4日星期二
<input type="checkbox" class="colour-button1" value="10 - 12" id="btn1" disabled/><label for="btn1" style="position:relative;"><i class="fa fa-check-circle fa-lg hide11" id="chk-btn1"></i> Tuesday, April 4th</label>
<br><br>
<input type="checkbox" class="colour-button1" value="10 - 12" id="btn2" disabled /><label for="btn2" class="labe1" style="position:relative;"><i class="fa fa-check-circle fa-lg hide11" id="chk-btn2"></i> Thursday, April 6th</label>
<br><br>
<input type="checkbox" class="colour-button1" value="10 - 12" id="btn3" disabled/><label for="btn3" style="position:relative;"><i class="fa fa-check-circle fa-lg hide11" id="chk-btn3"></i> Tuesday, April 11th</label>
<br><br>
<input type="checkbox" class="colour-button1" value="10 - 12" id="btn4" disabled/><label for="btn4" class="labe1" style="position:relative;"><i class="fa fa-check-circle fa-lg hide11" id="chk-btn4"></i> Thursday, April 13th</label>
我尝试了这个,然后才能在我的表单上实现它,但我得到的是&#34; 3月27日星期一&#34;
<?php
error_reporting(E_ALL);
echo '<pre>';
// DAY NAMES TO WEEK INTERVALS
$weekdays = array
( 'Mon' => ' + 1 week'
, 'Tue' => ' + 6 days'
, 'Wed' => ' + 5 days'
, 'Thu' => ' + 4 days'
, 'Fri' => ' + 10 days'
, 'Sat' => ' + 11 days'
, 'Sun' => ' + 12 days'
)
;
// CREATE A RANGE OF ISO DATES FOR THIS WEEK
$anchor_day = 'last Monday';
if (date('D') == 'Mon') $anchor_day = 'Today';
$anchor = date('l, F dS', strtotime($anchor_day));
for( $i = 0; $i<4; $i++ )
{
$time = strtotime("$anchor + $i days");
$day = date('D', $time);
$days[$day] = date('l, F dS', strtotime("$anchor + $i days"));
}
// CREATE THE FUTURE DATES BY COMBINING ISO DAYS AND WEEKDAY RULES
foreach($days as $day => $iso)
{
$new = date('l, F dS', strtotime($iso . $weekdays[$day]));
echo PHP_EOL . "$day: $new";
}
?>