<u>复制代码</u> 代码如下:<br><?php <BR>$a = array (1,2,3,4,5,6,7,8,9,10,11); <br>$i = 0; <br>?> <br><table border="1"> <br><tr> <br> <br>foreach ($a as $k){ <br>if($i%3==0) {//该处表示需要横向排列的列数. <br>echo "</tr> <tr>"; <br>} <br>echo "<td>",$k,"</td>";//该处显示该列的数据. <br>$i ++; <br>} <br>?> <br> </tr> <br> </table> <br>