时时商务社区
标题:
简单的PHP日历算法
[打印本页]
作者:
网络通达
时间:
2018-2-18 04:49
/**
* 日历
*
* Copyright(c) 2007 by 陈毅鑫(深空). All rights reserved
* To contact the author write to
[color=]{@link
[color=]
mailto:
[email protected]
}
* @author 陈毅鑫(深空)
*/
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 = '[table]';
$html .= '[tr]';
$html .= '[td][url=' . $PHP_SELF . '?date=' . $pre . ']-[/url][/td]';
$html .= '[td]' . $date['year'] . ';' . $date['month'] . '[/td]';
$html .= '[td][url=' . $PHP_SELF . '?date=' . $next . ']+[/url][/td]';
$html .= '[/tr]';
$arr_tpl = array(0 => '', 1 => '', 2 => '', 3 => '', 4 => '', 5 => '', 6 => '');
$date_arr = array();
$j = 0;
for ($i = 0; $i
欢迎光临 时时商务社区 (http://bbs.4435.cn/)
Powered by Discuz! X3.2