复制代码 代码如下:
'', 1 => '', 2 => '', 3 => '', 4 => '', 5 => '', 6 => '');
$date_arr = array();
$j = 0;
for ($i = 0; $i if (!isset($date_arr[$j])) {
$date_arr[$j] = $arr_tpl;
}
$date_arr[$j][($i+$start['wday'])%7] = $i+1;
if ($date_arr[$j][6]) {
$j++;
}
}
foreach ($date_arr as $value) {
$html .= '';
foreach ($value as $v) {
if ($v) {
if ($v == $date['mday']) {
$html .= '' . $v . ' ';
} else {
$html .= '' . $v . ' ';
}
} else {
$html .= ' ';
}
}
$html .= '
';
}
$html .= '
';
echo $html;
?>
php日历代码2
复制代码 代码如下:
';
$html .= '';
$html .= '- ';
$html .= '' . $date['year'] . ';' . $date['month'] . ' ';
$html .= '+ ';
$html .= '
';
$arr_tpl = array(0 => '', 1 => '', 2 => '', 3 => '', 4 => '', 5 => '', 6 => '');
$date_arr = array();
$j = 0;
for ($i = 0; $i if (!isset($date_arr[$j])) {
$date_arr[$j] = $arr_tpl;
}
$date_arr[$j][($i+$start['wday'])%7] = $i+1;
if ($date_arr[$j][6]) {
$j++;
}
}
foreach ($date_arr as $value) {
$html .= '';
foreach ($value as $v) {
if ($v) {
if ($v == $date['mday']) {
$html .= '' . $v . ' ';
} else {
$html .= '' . $v . ' ';
}
} else {
$html .= ' ';
}
}
$html .= '
';
}
$html .= '
';
echo $html;
?>
下面这个也不错,提示有错误,思路清晰
复制代码 代码如下:
12)
{
$year += floor($month/12);
$month = $month % 12;
}
if($year > 2030) $year = 2030;
if($year }
$year = isset($year) ? $year : date('y');
$month = isset($month) ? $month : date('n');
if($year==date('y') && $month==date('n')) $today = date('j');
if($month-1 == 0)
$prevmonth = ($year - 1).12;
else $prevmonth = $year.($month - 1);
if($month+1 == 13)
$nextmonth = ($year+1).1;
else $nextmonth = $year.($month+1);
$prevyear = ($year - 1).$month;
$nextyear = ($year + 1).$month;
echo
$year - $month
>
>>
日
一
二
三
四
五
六
vkn;
$nowtime = mktime(0,0,0,$month,1,$year);//当月1号转为秒
$daysofmonth = date(t,$nowtime);//当月天数
$weekofbeginday = date(w,$nowtime);//当月第一天是星期几
$weekofendday = date(w,mktime(0,0,0,$month+1,0,$year));//当月最后一天是星期几
$daysofprevmonth = date(t,mktime(0,0,0,$month,0,$year));//上个月天数
$count = 1;//计数
//列出上月后几天
for($i = 1 ; $i {
echo .($daysofprevmonth-$weekofbeginday+$i). ;
$count++;
}
//当月全部
for($i = 1 ; $i {
$css = ($count%7==0 || $count%7==1)?weekday:normalday;
if($i == $today) $css .= today;
echo .$i. ;
if($count%7==0) echo ;
$count++;
}
//下月前几天
for ($i = 1;$i {
echo .$i. ;
}
echo
vkn;
}
?>
nbsp;html public -//w3c//dtd xhtml 1.0 transitional//en http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd>
calendar
http://www.bkjia.com/phpjc/318769.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/318769.htmltecharticle比较不错的一款php日历代码 复制代码 代码如下: ?php /** * 日历 * * copyright(c) 2007 by 陈毅鑫(深空). all rights reserved * to contact the author write to {@...
