<p class="sycode"> <br> <br> <br> <br> <br> <br> </p> <br> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <br> <title>用php绘制表格示例</title> <br> <br> <br> <?php <br /> define(MAX_NUM, 20); <br> $bc = "000000"; <br> $color = array(); <br> for ($i=0; $i { <br> $color[$i] = "#" . $bc; <br> $bc += 0x00000f; <br> //echo($color[$i] . "\t"); <br> } <br> echo "<hr>"; <br> <br> <br> ?> <br> <br> <br> <br> <br> <br> <br> <table border="2" cellspacing="0" cellpadding="0"> <br> <tr> <br> <td width="40" height="40" rand echo>> </td> <br> <td width="40" height="40" rand echo>> </td> <br> </tr> <br> <tr> <br> <td width="40" height="40" bgcolor="#FFFF00"> </td> <br> <td width="40" height="40" bgcolor="#FF00FF"> </td> <br> </tr> <br> </table> <br> <br> <br> <table cellspacing="0" cellpadding="0"> <br> <?php <br /> for ($i=1; $i { <br> echo("<tr>"); <br> for ($j=1; $j { <br> $s = $i * $j; <br> $r = rand(1, 9999); <br> echo("<td width='\"40\"' height='\"40\"'></td> echo(" bgcolor=\"$color[$r]\"> "); <br> <br> } <br> echo("</tr>"); <br> } <br> ?> <br> </table> <br> <br> <br> <br>