1
0
0

php实现日历效果

西瓜太郎
20天前 88
<?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>';


?>
最新回复 (1)
  • 小助理
    20天前
    0 引用 2

    谢谢分享

请先登录后发表评论!

返回
请先登录后发表评论!