<?php $title='员工信息表'; $arr = array( array( 'id' => 1, 'name' => '朱一龙', 'age' => 18, 'password'=>'123456' ), array( 'id' => 2, 'name' => '阿护', 'age' => 19, 'password'=>'123456' ), array( 'id' => 3, 'name' => '太师', 'age' =>20, 'password'=>'123456' ), array( 'id' => 4, 'name' => '徐正曦', 'age' => 18, 'password'=>'123456' ) ); ?> <!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 $length=count($arr); $i=0; for($i; $i<$length; $i++){ echo ' <tr> <td>'.$arr[$i]['id'].'</td> <td>'.$arr[$i]['name'].'</td> <td>'.$arr[$i]['age'].'</td> <td>'.$arr[$i]['password'].'</td> </tr> '; }?> </table> </body> </html>