Correction status:Uncorrected
Teacher's comments:
<?php $title='员工信息表'; $arr = array( array( 'id'=>1, 'name'=>'朱一龙', 'age' =>18, 'sex'=>'男' ), array( 'id'=>2, 'name'=>'般若', 'age' =>20, 'sex'=>'女' ), array( 'id'=>3, 'name'=>'阿护', 'age' =>20, 'sex'=>'男' ), array( 'id'=>4, 'name'=>'明玉', 'age' =>30, 'sex'=>'女' ) ); function CreatTable($arr){ $res=''; foreach ($arr as $value) { $res.='<tr><td>'.$value['id'].'</td>'; $res.='<td>'.$value['name'].'</td>'; $res.='<td>'.$value['age'].'</td>'; $res.='<td>'.$value['sex'].'</td>'; $res.='</tr>'; } echo $res; } ?> <!DOCTYPE html> <html> <head> <title>员工信息表</title> <style> *{ margin: 0; padding: 0; } table{ widows: 400px; margin:100px auto; border-collapse:collapse } th{ width: 100px; height: 30px; background: paleturquoise; border: 1px solid black } td{ width: 100px; height: 30px; border: 1px solid black; text-align: center; } </style> </head> <body> <h1><?php echo $title;?></h1> <table cellpadding="0" cellspacing="0"> <tr> <th>编号</th> <th>姓名</th> <th>年龄</th> <th>性别</th> </tr> <?php CreatTable($arr); ?> </table> </body> </html>