php日历代码分享 简单实用的php日历代码

WBOY
Libérer: 2016-07-25 08:56:09
original
2707 Les gens l'ont consulté
  1. header("content-type:text/html;charset=utf-8");
  2. ?>
  3. /**
  4. * 简单实用的php日历代码
  5. * edit: bbs.it-home.org
  6. */
  7. if(!emptyempty($_GET)){
  8. $year = $_GET['year'];
  9. $month = $_GET['month'];
  10. }
  11. if(emptyempty($year)){
  12. $year = date('Y');
  13. }
  14. if(emptyempty($month)){
  15. $month = date('m');
  16. }
  17. $start_weekday = date('w',mktime(0,0,0,$month,1,$year));
  18. //echo $start_weekday;
  19. $days = date('t',mktime(0,0,0,$month,1,$year));
  20. //echo $days;
  21. $week = array('星期日','星期一','星期二','星期三','星期四','星期五','星期六');
  22. $i = 0;
  23. $k = 1;
  24. $j = 0;
  25. echo '';
  26. echo '
  27. ';
  28. echo '
  29. ';
  30. for($i = 0;$i echo '
  31. ';
  32. }
  33. echo '
  34. ';
  35. echo '
  36. ';
  37. for($j = 0;$j echo '
  38. ';
  39. }
  40. while($k if($k == date('d')){
  41. echo '
  42. ';
  43. }else{
  44. echo '
  45. ';
  46. }
  47. if(($j+1) % 7 == 0){
  48. echo '
  49. ';
  50. }
  51. $j++;
  52. $k++;
  53. }
  54. while($j % 7 != 0){
  55. echo '
  56. ';
  57. $j++;
  58. }
  59. echo '
  60. ';
  61. echo '
  62. ';
  63. echo "
  64. ';
  65. echo "
  66. ';
  67. echo '
  68. ';
  69. echo "
  70. ';
  71. echo "
  72. ';
  73. echo '
  74. ';
  75. echo '
  76. '.$year.'年'.$month.'月'.'
    '.$week[$i].'
    '.$j.' '.$k.' '.$k.'
    '.$j.'
    ".' ".' ';
  77. echo '
    ';
  78. echo ''.'年';
  79. echo '';
  80. echo '月';
  81. echo '';
  82. echo '
  83. ';
  84. echo '
  85. ".'>>'.' ".'>'.'
    ';
  86. function lastYear($year,$month){
  87. $year = $year-1;
  88. return "year=$year&month=$month";
  89. }
  90. function lastMonth($year,$month){
  91. if($month == 1){
  92. $year = $year -1;
  93. $month = 12;
  94. }else{
  95. $month--;
  96. }
  97. return "year=$year&month=$month";
  98. }
  99. function nextYear($year,$month){
  100. $year = $year+1;
  101. return "year=$year&month=$month";
  102. }
  103. function nextMonth($year,$month){
  104. if($month == 12){
  105. $year = $year +1;
  106. $month = 1;
  107. }else {
  108. $month++;
  109. }
  110. return "year=$year&month=$month";
  111. }
  112. ?>
复制代码

>>> 您可能感兴趣的文章: php calender日历代码(解决2038问题) php日历代码(附演示效果) php日历代码 php实现的高效日历代码 php日历代码 三个不错的php日历代码 分享一例PHP简单日历代码 php简单日历的实现代码(可绑定事件)



source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!