<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> <table width="100%" border="1" cellpadding="0" cellspacing="0"> <tr> <td>代号</td> <td>姓名</td> <td>性别</td> <td>民族</td> <td>生日</td> </tr> <?php $attr = array( array("p001","李四",true,"汉族","1998-2-3"), array("p002","夏天",true,"回族","1998-2-3"), array("p003","王小二",true,"维吾尔族","1978-2-3"), array("p004","小刘",true,"汉族","1986-2-3"), ); //规定用表格形式显示出表中的数据 foreach($attr as $v) { echo "<tr> <td>{$v[0]}</td> <td>{$v[1]}</td> <td>{$v[2]}</td> <td>{$v[3]}</td> <td>{$v[4]}</td> </tr>"; } ?> </table> </body> </html>
显示的结果: