-
-
header("content-type:text/html;charset=utf-8");
- ? >
-
-
- 表格{
- 邊距:0px;
- 內邊距:0px;
- }
- td{
- 文字對齊:中心;
- 寬度:80px;
- }
- 樣式>
-
}
- 樣式>
-
}
- 樣式>
-
}
- 樣式>
-
}
- 樣式>
-
/**
- * 簡單實用的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,$月,1,$年));
- //回顯$days;
- $week = array('星期日','星期一','星期二','星期三','星期四','星期五','星期六');
- $i = 0;
- $k = 1;
- $j = 0;
- echo '';
- echo '
'.$year.'年'. $month.'月'.' | '; - 回顯'
'; - for($i = 0;$i echo '
'.$week[$i].' | ';
- }
- 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 "
".' td>'; - echo '
'; - echo '';
- echo '';
- for($start_year = 1970;$start_year echo ''.$start_year.' ';
- }
- echo ''.'年';
- echo '';
- for($start_month = 1;$start_month echo ''.$start_month.'' ;
- }
- echo '' ;
- 回顯「月」;
- echo '';
- echo '';
- 回顯'
| ';
- echo "
".'>>'.' | ' ;
- echo "
".'>'.' | ';
- 回顯'
|
';
- echo '
|
';
函數lastYear($year,$month){
$year = $year-1;
return "年=$年&月=$月";
}
函數lastMonth($year,$month){
if($month == 1){
$year = $year -1 ;
$月= 12;
}其他{
$月--;
}
return "年=$年&月=$月";
}
函數nextYear($year,$month){
$year = $year+1;
return "年=$年&月=$月"; } 函數nextMonth($year, $month){ if($month == 12){ $year = $year +1; $月= 1; }else { $month++; } return "年=$年&月=$月"; } ?>複製程式碼>>> 您可能有興趣的文章:
php calender日曆程式碼(解決2038問題)
php日曆程式碼(附示範效果)
php日曆程式碼 php實作的高效日曆程式碼
php日曆程式碼 三個不錯的php日曆程式碼
分享一例PHP簡單日曆程式碼
php簡單日曆的實作碼(可綁定事件)