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

PHP development to create a simple calendar setting tr and td in the table

113.png

Set the draw method, draw the table, and set the tr and td in the table

1) The data will be displayed using the table tag, so here you need to set the tr and td under each tr. td arranged

 2)$index % 7 == 0 Calculate the first column of each row of the table

 3)$index % 7 == 6 || $index == ($length -1) Calculate the last column of each row, or the last data of $caculate

 4) Add the middle row to $tr, which is the array

<?php
function draw($caculate) {  //$caculate 通過caculate方法計(jì)算后的數(shù)據(jù)
      $tr = array();
      $length = count($caculate);
      $result = array();
      foreach ($caculate as $index => $date) {
         if($index % 7 == 0) {//第一列
            $tr = array($date);
         }elseif($index % 7 == 6 || $index == ($length-1)) {
            array_push($tr, $date);
            array_push($result, $tr);//添加到返回的數(shù)據(jù)中
            $tr = array();//清空數(shù)組列表
         }else {
            array_push($tr, $date);
         }
      }
      return $result;
   }

?>


# of each row ##

Continuing Learning
||
<?php function draw($caculate) { //$caculate 通過caculate方法計(jì)算后的數(shù)據(jù) $tr = array(); $length = count($caculate); $result = array(); foreach ($caculate as $index => $date) { if($index % 7 == 0) {//第一列 $tr = array($date); }elseif($index % 7 == 6 || $index == ($length-1)) { array_push($tr, $date); array_push($result, $tr);//添加到返回的數(shù)據(jù)中 $tr = array();//清空數(shù)組列表 }else { array_push($tr, $date); } } return $result; } ?>
submitReset Code