<?php
/*
* Created on 2016-7-20
*/
SimCalendar('2016-08');//显示8月份日历
function SimCalendar($date)
{
/**
* 简单日历输出,本函数需要cal_days_in_month的支持
* @param $date Y-m 要输出的日期
*/
echo '<table border="1">
<thead>
<tr>
<th>日</th>
<th>一</th>
<th>二</th>
<th>三</th>
<th>四</th>
<th>五</th>
<th>六</th>
</tr>
</thead>
<tbody>';
$date_array = explode('-', $date);
$start_week = 0;//从星期天开始为0
$month = cal_days_in_month(CAL_GREGORIAN, $date_array[1], $date_array[0]);//当月的天数
$wstar = date('w', strtotime($date . '-01'));//当月从星期几天始
$rows = ceil(($wstar + $month) / 7);//总行数
$mday = 1;//第几天
for ($i = 0; $i < $rows; $i++) {
echo '<tr>';
for ($d = 0; $d < 7; $d++) {
$nowday = 7 * $i + $d + $start_week;
if ($nowday >= $wstar && $mday <= $month) {
$temp = date('d', strtotime($date . '-' . $mday));
echo '<td>'.$temp . '</td>';
$mday++;
} else {
echo '<td> </td>';
}
}
echo '</tr>';
}
echo '</tbody>
</table>';
}
?>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有