Rumah > Soal Jawab > teks badan
<?php $aaa = "67"; $bbb = "98"; $ccc = "43"; ?> <table class="auto-style1" style="width: 28%; height: 134px"> <tr> <td class="auto-style2">姓名</td> <td class="auto-style2">成绩</td> <td class="auto-style2">等级</td> </tr> <tr> <td class="auto-style2">AAA</td> <td class="auto-style2"><?php echo $aaa; ?></td> <td class="auto-style2"></td> </tr> <tr> <td class="auto-style2">BBB</td> <td class="auto-style2"><?php echo $bbb; ?></td> <td class="auto-style2"> </td> </tr> <tr> <td class="auto-style2">CCC</td> <td class="auto-style2"><?php echo $ccc; ?></td> <td class="auto-style2"> </td> </tr> </table>
Bagaimana untuk mencapai kedudukan sel hierarki?
PHP中文网2017-05-31 09:32:23
<?php $list=array( array('name'=>'AAA','score'=>67,'dengji'=>0), array('name'=>'BBB','score'=>98,'dengji'=>0), array('name'=>'CCC','score'=>43,'dengji'=>0), ); function cmp($a,$b){ global $list; $a=$list[$a]['score']; $b=$list[$b]['score']; if($a>$b){ return true; } return false; } uksort($list,'cmp'); $list=array_values($list); echo '姓名|分数|名次<br>'; foreach($list as $k=>$row){ echo $row['name'].'|'.$row['score'].'|'.($k+1); }