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

テーブルに簡単なカレンダー設定trとtdを作成するPHP開発

113.png

描畫メソッドを設定し、テーブルを描畫し、テーブルにtrとtdを設定します

1)tableタグを使ってデータを表示するので、ここで各trの下にtdを配置する必要があります

2 )$index % 7 = = 0 テーブルの各行の最初の列を計算します

3)$index % 7 == 6 || $index == ($length-1) 各行の最後の列を計算します、または$caculateの最後のデータ

4 )各行の配列である$trに真ん中の行を追加

<?php
function draw($caculate) {  //$caculate 通過caculate方法計算后的數(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;
   }

?>


學び続ける
||
<?php function draw($caculate) { //$caculate 通過caculate方法計算后的數(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; } ?>