日期:2014-05-17 浏览次数:20428 次
$a=array( array('领导','张三'), array('领导','李四'), array('领导','王五') ); foreach($a as $k=>$b){ if(!$tem[$b[0]]) $tem[$b[0]]=$b; else $a[$k][0]=''; } echo "<table align=center width=200 cellspacing=0 cellspadding=0>"; foreach($a as $v){ echo "<tr>"; echo "<td>".$v[0]."</td>"; echo "<td>|".$v[1]."</td>"; echo "</tr>"; } echo "</table>";
------解决方案--------------------
header("content-type:text/html;charset=utf-8"); $a=array( array('领导','张三'), array('领导','李四'), array('领导','王五') ); echo "<table>"; foreach($a as $k => $v){ echo "<tr>"; if($k === 0) { echo "<td>".$v[0]."</td>"; echo "<td>|".$v[1]."</td>"; } else { echo "<td></td><td>|".$v[1]."</td>"; } echo "</tr>"; } echo "</table>";