} } $html .= "</table>"; return $html; } function buildMonth() { return date('t', mktime(0, 0, 0, $this->month, 1, $this->year)); } function isFirst($day) { if (date('w', mktime(0, 0, 0, $this->month, $day, $this->year)) == 0) { return true; } return false; } function isLast($day) { if (date('w', mktime(0, 0, 0, $this->month, $day, $this->year)) == 6) { return true; } return false; } function getDay($day) { return date('w', mktime(0, 0, 0, $this->month, $day, $this->year)); } } $c = new Calender(); echo $c->build();
for ($i = 0; $i < $days; $i++) { $html .= "<td> </td>"; } return $html; } //日历末尾填充 function padLast() { $html = ''; $days = 6 - $this->getWday($this->getDays()); for ($i = 0; $i < $days; $i++) { $html .= "<td> </td>"; } return $html; } //上个月 function lastMonth() { $year = $this->date['year']; $lastmonth = $this->date['mon'] - 1; if ($lastmonth < 1) { $year = $year - 1; $laetmonth = 1; } return "<a href='{$_SERVER['PHP_SELF']}?date={$year}-{$lastmonth}'><<</a>"; } } list($year, $month) = explode('-', $_GET['date']); $c = new Calender(); echo $c->build($year, $month);