php 百度日历,php日历

year = date ( 'Y' );$this->month = date ( 'm' );$this->val = $val;$vars = get_class_vars ( get_class ( $this ) );foreach ( $options as $key => $value ) {if (array_key_exists ( $key, $vars )) {$this->$key = $value;}}}function display() {$value .= '';$value .= $this->showChangeDate ();$value .= $this->showWeeks ();$value .= $this->showDays ( $this->year, $this->month );$value .= '';return $value;}private function showWeeks() {$value .= '

';foreach ( $this->weeks as $title ) {$value .= '' . $title . '';}$value .= '';return $value;}private function showDays($year, $month) { $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 <= $weekofbeginday ; $i++) { $value .= "".($daysofprevmonth-$weekofbeginday+$i).""; $count++; } //当月全部 for($i = 1 ; $i <= $daysofmonth ; $i++) { $css = ($count%7==0 || $count%7==1)?"weekday":"normalday"; if($i == $today) $css .= "today"; $value .= "".$i.""; if($count%7==0) $value .= "

"; $count++; } //下月前几天 for ($i = 1;$i <= 6-$weekofendday;$i++) { $value .= "".$i.""; } $value .= ''; return $value;}private function showChangeDate() {$url = basename ( $_SERVER ['PHP_SELF'] );$value = '

';$value .= '';$value .= '';for($ye = 1970; $ye <= 2038; $ye ++) {$selected = ($ye == $this->year) ? 'selected' : '';$value .= '' . $ye . '';}$value .= '';$value .= '';for($mo = 1; $mo <= 12; $mo ++) {$selected = ($mo == $this->month) ? 'selected' : '';$value .= '' . $mo . '';}$value .= '';$value .= '';$value .= '';return $value;}private function preYearUrl($year, $month) {$year = ($this->year <= 1970) ? 1970 : $year - 1;return 'year=' . $year . '&month=' . $month;}private function nextYearUrl($year, $month) {$year = ($year >= 2038) ? 2038 : $year + 1;return 'year=' . $year . '&month=' . $month;}private function preMonthUrl($year, $month) {if ($month == 1) {$month = 12;$year = ($year <= 1970) ? 1970 : $year - 1;} else {$month --;}return 'year=' . $year . '&month=' . $month;}private function nextMonthUrl($year, $month) {if ($month == 12) {$month = 1;$year = ($year >= 2038) ? 2038 : $year + 1;} else {$month ++;}return 'year=' . $year . '&month=' . $month;}}

$year, 'month' => $month );if (isset ( $_GET ['year'] ) && isset ( $_GET ['month'] )) {$params = array ('year' => $_GET ['year'], 'month' => $_GET ['month'] );$year = $_GET ['year'];$month = $_GET ['month'];}$cal = new Calendar ( $params, $list_sign );echo $cal->display ();?>

相关标签:php日历

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值