<div class="jb51code">
<pre class="brush:PHP;">
<table width="100%" border="0" cellspacing="1" cellpadding="0" style="background:#CCC">
<tr>
<td align="center" bgcolor="#FFFFFF">第一列</td>
<td align="center" bgcolor="#FFFFFF">第二列</td>
</tr>
<tr>
<?php
$setarr = array(0,1,2,3,4,5,6,7,8,9); //相当于数据库获取的数组
$i=0;
foreach($setarr as $val){
$i++;
?>
<?=$val?>
<?PHP
if($i%2==0&&$i<count($setarr)) echo '</tr><tr>';
} ?>
</tr>
</table>