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

??? ??? ???? ???? ??? ??? ??? PHP ??

113.png

??? ??? ???? ???? ??? ?? ?? ?? ?????.

1) ?? ?? ??? ?????. ?? 1?? ???? ?? ?? ?? ?? ??? ?? ???? ???? ???.

2) ??? ?????. ?? ?? ?? ??? ??? CSS ???? ?????

3) ???, ???, ??? ? ?? ???? ?? ?? ??? ?????

<?php
function caculate($calendar) {   //$calendar 通過threshold方法計(jì)算后的數(shù)據(jù)
    $days = $calendar['days'];
    $firstDayOfWeek = $calendar['firstDayOfWeek'];//本月第一天的星期
    $lastDayOfWeek = $calendar['lastDayOfWeek'];//本月最后一天的星期
    $lastMonthOfLastDay = $calendar['lastMonthOfLastDay'];//上個(gè)月的最后一天
    $year = $calendar['year'];
    $month = $calendar['month'];
    $dates = array();
    
   if($firstDayOfWeek != 7) {
      $lastDays = array();
      $current = $lastMonthOfLastDay;//上個(gè)月的最后一天
      for ($i = 0; $i < $firstDayOfWeek; $i++) {
         array_push($lastDays, $current);//添加上一個(gè)月的日期天數(shù)
         $current--;
      }
      $lastDays = array_reverse($lastDays);//反序
      foreach ($lastDays as $index => $day) {
         array_push($dates, array('day' => $day, 'tdclass' => ($index ==0 ?'rest':''), 'pclass' => 'outter'));
      }
   }
   
   //本月日歷信息
   for ($i = 1; $i <= $days; $i++) {
      $isRest = $this->_checkIsRest($year, $month, $i);
      //判斷是否是休息天
      array_push($dates, array('day' => $i, 'tdclass' => ($isRest ?'rest':''), 'pclass' => ''));
   }
   
   //下月日歷信息
   if($lastDayOfWeek == 7) {//最后一天是星期日
      $length = 6;
   }
   elseif($lastDayOfWeek == 6) {//最后一天是星期六
      $length = 0;
   }else {
      $length = 6 - $lastDayOfWeek;
   }
   for ($i = 1; $i <= $length; $i++) {
      array_push($dates, array('day' => $i, 'tdclass' => ($i==$length ?'rest':''), 'pclass' => 'outter'));
   }
   
   return $dates;
}
?>

??:

array_push() ??? ? ?? ????? ?? ?? ?????. ?? ??? ??? ???? ? ??? ??? ?????.

array_reverse() ??? ??? ???? ?????.

???? ??
||
<?php function caculate($calendar) { //$calendar 通過threshold方法計(jì)算后的數(shù)據(jù) $days = $calendar['days']; $firstDayOfWeek = $calendar['firstDayOfWeek'];//本月第一天的星期 $lastDayOfWeek = $calendar['lastDayOfWeek'];//本月最后一天的星期 $lastMonthOfLastDay = $calendar['lastMonthOfLastDay'];//上個(gè)月的最后一天 $year = $calendar['year']; $month = $calendar['month']; $dates = array(); if($firstDayOfWeek != 7) { $lastDays = array(); $current = $lastMonthOfLastDay;//上個(gè)月的最后一天 for ($i = 0; $i < $firstDayOfWeek; $i++) { array_push($lastDays, $current);//添加上一個(gè)月的日期天數(shù) $current--; } $lastDays = array_reverse($lastDays);//反序 foreach ($lastDays as $index => $day) { array_push($dates, array('day' => $day, 'tdclass' => ($index ==0 ?'rest':''), 'pclass' => 'outter')); } } //本月日歷信息 for ($i = 1; $i <= $days; $i++) { $isRest = $this->_checkIsRest($year, $month, $i); //判斷是否是休息天 array_push($dates, array('day' => $i, 'tdclass' => ($isRest ?'rest':''), 'pclass' => '')); } //下月日歷信息 if($lastDayOfWeek == 7) {//最后一天是星期日 $length = 6; } elseif($lastDayOfWeek == 6) {//最后一天是星期六 $length = 0; }else { $length = 6 - $lastDayOfWeek; } for ($i = 1; $i <= $length; $i++) { array_push($dates, array('day' => $i, 'tdclass' => ($i==$length ?'rest':''), 'pclass' => 'outter')); } return $dates; } ?>