Verwenden Sie PHP, um das Niveau zu berechnen
wanfuwu
wanfuwu 2017-05-30 21:13:36
0
2
719

20170530161608_365.png

<?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">&nbsp;</td>
    </tr>
    <tr>
        <td class="auto-style2">CCC</td>
        <td class="auto-style2"><?php
         echo $ccc;
 ?></td>
        <td class="auto-style2">&nbsp;</td>
    </tr>
</table>

Wie erreicht man eine hierarchische Zellenrangfolge?


wanfuwu
wanfuwu

Antworte allen(2)
Ty80
<?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);
}


  • Antwort 名次从高到低显示
    PHP中文网 Autor 2017-05-31 09:41:11
phpcn_u2725

成绩进行范围性的判断

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!