请登录后探索更多精彩内容!
<?php echo'<table border="1" width="800">'; echo '<caption><h2>2020年3月</h2></caption>'; echo '<tr>'; echo '<th>星期日</th>'; echo '<th>星期一</th>'; echo '<th>星期二</th>'; echo '<th>星期三</th>'; echo '<th>星期四</th>'; echo '<th>星期五</th>'; echo '<th>星期六</th>'; echo '</tr>'; //本月有多少天 $integer=30; //今天星期几 $w = date('w'); $whiletr =1; while($whiletr <= $integer){ echo'<tr>'; for($i = 0; $i < 7 ; $i ++){ if($whiletr > $integer || ($w > $i && $whiletr == 1) ){ echo'<td>' . '</td>'; }else{ echo'<td>' .$whiletr.'</td>'; $whiletr ++; } } echo'</tr>'; } echo'</table>'; ?>
暂无评论
暂无评论