/**
* Calendar
*
* Copyright (c) by Chen Yixin (Deep Space). All rights reserved
* To contact the author write to {@link mailto:shenkong@php.net}
* @author Chen Yixin (Deep Space)
*/
if (function_exists (' Date_default_timezone_set ')) {
Date_default_timezone_set (' asia/chongqing ');
}
$date = isset ($_get[' date ')? $_get[' Date ': Date (' y-m-d ');
$date = getdate (Strtotime ($date));
$end = getdate (mktime (0, 0, 0, $date [' mon '] + 1, 1, $date [' Year '])-1);
$start = getdate (mktime (0, 0, 0, $date [' mon '], 1, $date [' Year ']);
$pre = Date (' y-m-d ', $start [0]-1);
$next = Date (' y-m-d ', $end [0] + 86400);
$html = '
'; $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 < $end [' Mday ']; $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;
http://www.bkjia.com/PHPjc/371563.html www.bkjia.com true http://www.bkjia.com/PHPjc/371563.html techarticle /** * Calendar * * Copyright (c) by Chen Yixin (Deep Space). All rights reserved * To contact the author write to {@link mailto:shenkong@php.net} * @author Chen Yixin (Deep Space) */if (Fu ...