Correction status:Uncorrected
Teacher's comments:
<!-- 2月21日作业 1. 使用foreach/if替代语法循环遍历二维数组 2.制作: 员工管理系统 后台首页, 要求简洁美观,体会<a>标签的target属性 与iframe 的name属性之间的关系 --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <!-- <title>派彩表单</title> --> <!-- <title><?php echo '派彩表单';?></title> --> <title><?php echo '下注记录'?></title> <!-- <title><?php echo 下注记录;?></title> --> <style> div{width: 1100;height: 600px;background: #EAEAEA;margin: 50px;} td{width:8%; text-align: center;} </style> </head> <body> <div> <table width="100%" border="1" bordercolor="#ccc" cellspacing="0" cellpadding="0" align="center"> <tr> <th width="8.5%" rowspan="2">期数</th> <th rowspan="2">中奖号码</th> <th colspan="2">大</th> <th colspan="2">小</th> <th colspan="2">单</th> <th colspan="2">双</th> <th width="8.5%" rowspan="2">本局输赢</th> <th width="8.5%" rowspan="2">今日输赢</th> </tr> <tr> <td>下注</td> <td>派彩</td> <td>下注</td> <td>派彩</td> <td>下注</td> <td>派彩</td> <td>下注</td> <td>派彩</td> </tr> <?php $record =[ ['id'=>1,'number'=>2,'bBet'=>1,'bwinNumber'=>2,'sBet'=>1,'swinNumber'=>2,'suBet'=>1,'suwinNumber'=>2,'dBet'=>1,'dwinNumber'=>2,'chwin'=>20,'today'=>10], ['id'=>1,'number'=>2,'bBet'=>1,'bwinNumber'=>2,'sBet'=>1,'swinNumber'=>2,'suBet'=>1,'suwinNumber'=>2,'dBet'=>1,'dwinNumber'=>2,'chwin'=>20,'today'=>10], ['id'=>1,'number'=>2,'bBet'=>1,'bwinNumber'=>2,'sBet'=>1,'swinNumber'=>2,'suBet'=>1,'suwinNumber'=>2,'dBet'=>1,'dwinNumber'=>2,'chwin'=>20,'today'=>10], ['id'=>1,'number'=>2,'bBet'=>1,'bwinNumber'=>2,'sBet'=>1,'swinNumber'=>2,'suBet'=>1,'suwinNumber'=>2,'dBet'=>1,'dwinNumber'=>2,'chwin'=>20,'today'=>10], ]; ?> <?php foreach($record as $recorder):?> <tr> <td><?= $recorder['id'];?></td> <td><?php echo $recorder['number'];?></td> <td><?php echo $recorder['bBet'];?></td> <td><?php echo $recorder['bwinNumber'];?></td> <td><?php echo $recorder['sBet'];?></td> <td><?php echo $recorder['swinNumber'];?></td> <td><?php echo $recorder['suBet'];?></td> <td><?php echo $recorder['suwinNumber'];?></td> <td><?php echo $recorder['dBet'];?></td> <td><?=$recorder['dwinNumber'];?></td> <td> <?php if($recorder['chwin']<0):?> 你输了:$recorder['chwin'] <?php else:?> 你赢了:<?php echo $recorder['chwin'];?> <?php endif;?> </td> <td> <?=$recorder['today']<0?'输了:'.$recorder['today']:'赢了:'.$recorder['today']?> </td> </tr> <?php endforeach;?> </table> </div> </body> </html>
点击 "运行实例" 按钮查看在线实例