亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP development to create a simple calendar reference CLASS class

1. New a Calendar class

2. Initialize the data in the two drop-down boxes, year and month

3. Initialize the year and month to be searched

4. Calculate the data information of each day in the calendar, including css and number of days

Refer to the previously encapsulated Calendar class

<?php
include_once 'calendar.php';
?>

The include_once() statement is included and included during script execution Run the specified file. This behavior is similar to the include() statement, the only difference is that if the code in the file is already included, it will not be included again. As the name of this statement implies, it will only be included once.

Instantiate this class:

<?php
$util = new Calendar();
?>

You also need to define the year and month arrays and obtain them through POST

<?php
$years = array(2014, 2015, 2016, 2017, 2018);//年份選擇自定義
$months = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);//月份數(shù)組
//獲取post的年份數(shù)據(jù)
if(empty($_POST['ddlYear'])) {
   $year = date('Y');
}else {
   $year = $_POST['ddlYear'];
}
//獲取post的月份數(shù)據(jù)
if(empty($_POST['ddlMonth'])) {
   $month = date('n');
}else {
   $month = $_POST['ddlMonth'];
}
?>

Get the threshold method, caculate method and draw method.

<?php
$calendar = $util->threshold($year, $month);//獲取各個(gè)邊界值
$caculate = $util->caculate($calendar);//獲取計(jì)算日歷的天數(shù)與樣式
$draws = $util->draw($caculate);//畫(huà)表格,設(shè)置table中的tr與td
?>


Continuing Learning
||
<?php include_once 'calendar.php'; $util = new Calendar(); //實(shí)例化一個(gè)類(lèi) $years = array(2014, 2015, 2016, 2017, 2018);//年份選擇自定義 $months = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);//月份數(shù)組 //獲取post的年份數(shù)據(jù) if(empty($_POST['ddlYear'])) { $year = date('Y'); }else { $year = $_POST['ddlYear']; } //獲取post的月份數(shù)據(jù) if(empty($_POST['ddlMonth'])) { $month = date('n'); }else { $month = $_POST['ddlMonth']; } $calendar = $util->threshold($year, $month);//獲取各個(gè)邊界值 $caculate = $util->caculate($calendar);//獲取計(jì)算日歷的天數(shù)與樣式 $draws = $util->draw($caculate);//畫(huà)表格,設(shè)置table中的tr與td ?>
submitReset Code