1、這是乙個簡單的 php 例子
2、這個例子的功能是,實現乙個簡單的日曆顯示功能。
3、該函式的作用是:輸入指定的 年、月、日時,輸出當前月的日曆,並在輸入的指定 日期 中,突出顯示。
具體的**實現如下:
1簡易的頁面顯示為:<?php
2header("content-type: text/html;charset=utf-8");
34 date_default_timezone_set("prc");56
/*7* 日曆函式8*/
910/**
11* 輸出當前年、月的日曆
12* 2023年6月13日
13* @author gaoqing
14* @param int $year 年
15* @param int $month 月
16* @param int $day 當前日期
17* @return void 空
18*/
19function calendar($year, $month, $day)59
60//
4.2、依次的迴圈日期數,當 $i % 7 時,說明是下乙個星期,需要換行
61for ($j = 1; $j
<= $mont_day; $j++)";
64 }else
";66}67
$i++;
6869
if($i % 7 == 0)72}
7374
所有日期都迴圈後,判斷是否到了**末尾,如果沒到,用空格填充
75while ($i % 7 != 0)
7980
echo "";
8182
echo "";83}
8485 calendar(2015, 6, 13);
86 ?>
實現簡單日曆
當前年 asp label id lbyear runat server text asp label 當前月 asp label id lbmonth runat server text asp label asp button id premonth runat server text 上一月 ...
php 日曆排班的例子,PHP實現簡單日曆的案例
這篇文章主要介紹了php簡單日曆實現方法,涉及php日期與時間的相關運算操作,非常簡單實用,需要的朋友可以參考下 執行效果截圖如下 具體 如下 created on 2016 7 20 simcalendar 2016 08 顯示8月份日曆 function simcalendar date 簡單日...
php 日曆設定當月節假 PHP簡單日曆實現方法
執行效果截圖如下 具體 如下 created on 2016 7 20 simcalendar 2016 08 顯示8月份日曆 function simcalendar date 簡單日曆輸出,本函式需要cal days in month的支援 param date y m 要輸出的日期 echo ...