代码:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>表格输出</title>
</head>

<body>
<div style="text-align: center;color: brown">
<?php $b="while表格"; $c="#ff0004"; echo "<h1 color=".$c.">".$b."</h1>"?>
</div>
<table border="1" bordercolor="#FF0004" align="center" >
    <?php
    $out=0;
    while($out<10){
        $bg=$out%2==0 ? "#fffddd" :"#dddddd";#设置第一行颜色和第二行颜色
        echo "<tr bgcolor=".$bg.">";
        $in=0;
        while($in<10){
        echo "<td>".($out*10+$in)."</td>";
        $in++;
        }
        echo "</tr>";
        $out++;
    }
    ?>
</table>
</body>
</html>

显示结果

QQ截图20180509095807.png

Last modification:May 9th, 2018 at 09:59 am
正在沿街乞讨中……