<?php
header("content-type:text/html;charset=utf-8");
?>
<html>
<head>
<meta http-equiv="refresh" content="10"; charset=UTF-8">
<title>日历</title>
<style type="text/css">
.back{
width:360px;
height:500px;
background:#015482;
opacity:0.8;
margin:30px auto;
}
.time1{
width:338px;
height:80px;
color:white;
font-size:40px;
padding-top:20px;
padding-left:22px;
}
.time2{
color:#4097DB;
font-size:16px;
}
.date1{
width:360px;
height:50px;
color:#D3E0E9;
}
.date2{
height:50px;
margin-left:22px;
line-height:50px;
display:inline-block;
}
.arrows1{
width:0px;
border-color:#015482 #015482 #D3E0E9 #015482;
border-style:solid;
border-width:10px;
display:inline-block;
margin-left:150px;
}
.arrows2{
width:0px;
border-color: #D3E0E9 #015482 #015482 #015482;
border-style:solid;
border-width:10px;
display:inline-block;
margin-left:20px;
}
.back1{
width:360px;
height:300px;
color:white;
text-align:center;
font-size:18px;
}
.back1 table{
text-align:center;
color:white;
margin:0;
padding:0;
box-sizing: border-box;
}
td {
box-sizing: border-box;
border: solid 2px rgba(0,0,0,0);
}
.back1 table tr td:hover{
border:2px solid #6A9BB7;
box-sizing: border-box;
}
</style>
</head>
<body>
<div class="back">
<div class="time1"><?php echo date("H:i:s");?>
<div class="time2">
<?php
echo date("Y年m月d日");
//获取中文星期几:
$weekarray=array("日","一","二","三","四","五","六");
//先定义一个数组
echo "星期".$weekarray[date("w")];
$d=date('d');
$m=date('m');
$y=date('Y');
//判断每月的1号是周几
$weekday = date("l", mktime(0,0,0,$m,1,$y));
//月度
$date=(mktime(0,0,0,($m+1),1,2017)-mktime(0,0,0,$m,1,2017))/(60*60*24);
?></div>
</div>
<div class="date1">
<div class="date2"><?php echo date("Y年m月"); ?></div>
<div class="arrows1" onclick="last()"></div>
<div class="arrows2" onclick="next()"></div>
</div>
<div class="back1">
<table border="0" width="360px" height="270px" align="center">
<tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th>六</th></tr>
<?php
//1号是周日
if ($weekday == "Sunday") {
for ($i=0;$i<6;$i++){
echo "<tr>";
for($j=1;$j<=7;$j++){
$date1=$j+$i*7;
if ($date1<=$date) {
if ($d == $date1) {
echo "<td style='background:#0078Df;'>";
}else {
echo "<td>";
}
echo $date1."</td>";
}
}
echo "</tr>";
}
}
//1号是周一
if ($weekday == "Monday") {
for ($i=0;$i<6;$i++){
echo "<tr>";
for($j=0;$j<=6;$j++){
$date1=$j+$i*7;
if ($date1<1) {
echo"<td>"."</td>";
}
if ($date1<=$date && $date1>0) {
if ($d == $date1) {
echo "<td style='background:#0078Df;'>";
}else {
echo "<td>";
}
echo $date1."</td>";
}
}
echo "</tr>";
}
}
//1号是周二
if ($weekday == "Tuesday") {
echo "<tr><td></td><td></td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td></tr><tr>";
for ($i=0;$i<6;$i++){
for($j=0;$j<=6;$j++){
$date1=$j+$i*7+6;
if ($date1<=$date && $date1>0) {
if ($d == $date1) {
echo "<td style='background:#0078Df;'>";
}else {
echo "<td>";
}
echo $date1."</td>";
}
}
echo "</tr>";
}
}
//1号是周三
if ($weekday == "Wednesday") {
echo "<tr><td></td><td></td><td></td><td>1</td><td>2</td><td>3</td><td>4</td></tr><tr>";
for ($i=0;$i<6;$i++){
for($j=0;$j<=6;$j++){
$date1=$j+$i*7+5;
if ($date1<=$date && $date1>0) {
if ($d == $date1) {
echo "<td style='background:#0078Df;'>";
}else {
echo "<td>";
}
echo $date1."</td>";
}
}
echo "</tr>";
}
}
//1号是周四
if ($weekday == "Thursday") {
echo "<tr><td></td><td></td><td></td><td></td><td>1</td><td>2</td><td>3</td></tr><tr>";
for ($i=0;$i<6;$i++){
for($j=0;$j<=6;$j++){
$date1=$j+$i*7+4;
if ($date1<=$date && $date1>0) {
if ($d == $date1) {
echo "<td style='background:#0078Df;'>";
}else {
echo "<td>";
}
echo $date1."</td>";
}
}
echo "</tr>";
}
}
//1号是周五
if ($weekday == "Friday") {
echo "<tr><td></td><td></td><td></td><td></td><td></td><td>1</td><td>2</td></tr><tr>";
for ($i=0;$i<6;$i++){
for($j=0;$j<=6;$j++){
$date1=$j+$i*7+3;
if ($date1<=$date && $date1>0) {
if ($d == $date1) {
echo "<td style='background:#0078Df;'>";
}else {
echo "<td>";
}
echo $date1."</td>";
}
}
echo "</tr>";
}
}
//1号是周六
if ($weekday == "Saturday") {
echo "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td>1</td></tr><tr>";
for ($i=0;$i<6;$i++){
for($j=0;$j<=6;$j++){
$date1=$j+$i*7+2;
if ($date1<=$date && $date1>0) {
if ($d == $date1) {
echo "<td style='background:#0078Df;'>";
}else {
echo "<td>";
}
echo $date1."</td>";
}
}
echo "</tr>";
}
}
?>
</table>
</div>
</div>
</body>
</html>
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!