1
我從這裏驗證碼:Creation of weekly calender in php周曆減去週日
我的問題是,我怎麼讓它落得只有星期六有空嗎?
<?php
$dt = new DateTime;
if (isset($_GET['year']) && isset($_GET['week'])) {
$dt->setISODate($_GET['year'], $_GET['week']);
} else {
$dt->setISODate($dt->format('o'), $dt->format('W'));
}
$year = $dt->format('o');
$week = $dt->format('W');
?>
<center>
<a href="<?php echo $_SERVER['PHP_SELF'].'?week='.($week-1).'&year='.$year; ?>" style="padding-right: 600px">Previous Week</a> <!--Previous week-->
<a href="<?php echo $_SERVER['PHP_SELF'].'?week='.($week+1).'&year='.$year; ?>" style="padding-left: 600px">Next Week</a> <!--Next week-->
</center>
<table border="1" style="text-align: center" align="center">
<col width="100px" />
<col width="200px" />
<col width="200px" />
<col width="200px" />
<col width="200px" />
<col width="200px" />
<col width="200px" />
<tr>
<td>Time</td>
<?php
do {
echo "<td>" . $dt->format('l') . "<br>" . $dt->format('F d') . "</td>\n";
$dt->modify('+1 day');
} while ($week == $dt->format('W'));
?>
'爲($天= 1; $天<= 5; $天++ )' - (即改變7到5)這是你所追求的? –
到6你的意思是。他確實希望週六。否則你整個週末都會鬆動;) –
你好@SergeyVidusov,抱歉我發佈了錯誤的代碼。也許你知道這個答案? :) – rekt