-
-
header("content-type:text/html;charset=utf-8");
- ?>
-
-
-
/**
- * 简单实用的php日历代码
- * edit: bbs.it-home.org
- */
- if(!emptyempty($_GET)){
- $year = $_GET['year'];
- $month = $_GET['month'];
- }
- if(emptyempty($year)){
- $year = date('Y');
- }
- if(emptyempty($month)){
- $month = date('m');
- }
- $start_weekday = date('w',mktime(0,0,0,$month,1,$year));
- //echo $start_weekday;
- $days = date('t',mktime(0,0,0,$month,1,$year));
- //echo $days;
- $week = array('星期日','星期一','星期二','星期三','星期四','星期五','星期六');
- $i = 0;
- $k = 1;
- $j = 0;
- echo '
'; - echo '
'.$year.'年'.$month.'月'.' | ';
- echo '
'; - for($i = 0;$i echo '
'.$week[$i].' | ';
- }
- echo '
';
- echo '
'; - for($j = 0;$j echo '
'.$j.' | ';
- }
- while($k if($k == date('d')){
- echo '
'.$k.' | ';
- }else{
- echo '
'.$k.' | ';
- }
- if(($j+1) % 7 == 0){
- echo '
'; - }
- $j++;
- $k++;
- }
- while($j % 7 != 0){
- echo '
'.$j.' | ';
- $j++;
- }
- echo '
';
-
- echo '
'; - echo "
".' | ';
- echo "
".' | ';
- echo '
'; - echo '';
- echo '
| ';
- echo "
".'>>'.' | ';
- echo "
".'>'.' | ';
- echo '
';
- echo '
';
-
- function lastYear($year,$month){
- $year = $year-1;
- return "year=$year&month=$month";
- }
- function lastMonth($year,$month){
- if($month == 1){
- $year = $year -1;
- $month = 12;
- }else{
- $month--;
- }
- return "year=$year&month=$month";
- }
- function nextYear($year,$month){
- $year = $year+1;
- return "year=$year&month=$month";
- }
- function nextMonth($year,$month){
- if($month == 12){
- $year = $year +1;
- $month = 1;
- }else {
- $month++;
- }
- return "year=$year&month=$month";
- }
- ?>
复制代码
>>> 您可能感兴趣的文章:
php calender日历代码(解决2038问题)
php日历代码(附演示效果)
php日历代码 php实现的高效日历代码
php日历代码 三个不错的php日历代码
分享一例PHP简单日历代码
php简单日历的实现代码(可绑定事件)
|