Blogger Information
Blog 6
fans 0
comment 0
visits 2470
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
3.19作业
小5的博客
Original
407 people have browsed it
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
 table{border: 1px solid #ccc;text-align: center;margin: 0 auto;}
        td{height: 30px;width: 150px}
        h1{text-align: center}
    </style>
</head>
<body>
 <?php $a = '员工信息表'; echo '<h1>'.$a.'</h1>';?> //表头
 <table>
        <tr>
            <td>编号</td>
            <td>姓名</td>
            <td>性别</td>
            <td>年龄</td>
            <td>地址</td>
        </tr>
 <?php
 $array_1 = array(
 array(1,'阿朱1','男',20,'玉溪市'),
 array(2,'阿朱2','男',20,'玉溪市'),
 array(3,'阿朱3','男',20,'玉溪市'),
 array(4,'阿朱4','男',20,'玉溪市'),
 array(5,'阿朱5','男',20,'玉溪市'),
 array(6,'阿朱6','男',20,'玉溪市'),
 array(7,'阿朱7','男',20,'玉溪市'),
 );
 $length1 = count($array_1);//获取二维数组的一级数组数量
 $length = $length1 * 5;//数组总长(7*5=35)
 $c = 0;//二维数组中 一级数组的索引序号
 for ($length;$length > 0;$length--){
 if ($length % 5 == 0){            //通过求余数来判断是否是一个tr内的循环
 echo '<tr>';
 for ($b = 0;$b < 5;$b++){
 echo '<td>'.$array_1[$c][$b];
 }
 $c = $c + 1;                  //$array—_1数组 下一个下标自动加1
 }
        }
 ?>
 </table>
</body>
</html>


Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments