php案例2——用户列表页
一.用户列表页
1 <?php 2 $userInfo[]=array('id'=>'1','username'=>'clive1','sex'=>'男','age'=>'20'); 3 $userInfo[]=array('id'=>'2','username'=>'clive2','sex'=>'男','age'=>'20'); 4 $userInfo[]=array('id'=>'3','username'=>'clive3','sex'=>'男','age'=>'20'); 5 $userInfo[]=array('id'=>'4','username'=>'clive4','sex'=>'男','age'=>'20'); 6 $userInfo[]=array('id'=>'5','username'=>'clive5','sex'=>'男','age'=>'20'); 7 ?> 8 <!DOCTYPE html> 9 <html> 10 <head lang="en"> 11 <meta charset="UTF-8"> 12 <title>用户列表页</title> 13 </head> 14 15 <body> 16 <h3 style="text-align:center;">用户列表页</h3> 17 <table style="margin:0 auto;border:1px solid;width:80%;"> 18 <tr style="text-align:center;"> 19 <td>编号</td> 20 <td>用户名</td> 21 <td>性别</td> 22 <td>年龄</td> 23 <td>头像</td> 24 </tr> 25 <?php foreach ($userInfo as $val){ 26 ?> 27 <tr style="text-align:center;"> 28 <td><?php echo $val['id']; ?></td> 29 <td><?php echo $val['username']; ?></td> 30 <td><?php echo $val['sex']; ?></td> 31 <td><?php echo $val['age']; ?></td> 32 <td><img src="1.jpg" width="50" height="50"/></td> 33 </tr> 34 <?php } 35 ?> 36 37 </table> 38 39 40 </body> 41 </html>