php实现日历效果
7232708273 2022-7-23

<?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>';


?>
最新回复 (4)
全部楼主
  • 伊尹
    2022-7-25 2
    0
    顶顶顶顶顶顶顶!!!
  • 17327933349
    2022-7-31 3
    0
    你就是我心中的那首忐忑,总是让我惊心动魄。 
  • ccccc
    1月前 4
    0
    非常棒!!!
  • ccccc
    1月前 5
    0
    感谢楼主ing!!!
返回