$ary = array(
'a'=>array('a1','a2'),
'b'=>array('b1','b2'),
'c'=>array('c1','c2'),
);
如何把上面的数组,输出到页面成这样啊
------解决方案--------------------
echo '<table width="150px" border="1">';
foreach($ary['a'] as $aV){
foreach($ary['b'] as $bV){
foreach($ary['c'] as $cV){
echo "<tr><td>$aV</td><td>$bV</td><td>$cV</td></tr>";
}
}
}
echo '</table>';
------解决方案--------------------
$ary = array([code=html]<table>
'a'=>array('a1','a2'),
'b'=>array('b1','b2'),
'c'=>array('c1','c2'),
);
echo "<table>\n";
echo "<tr><td>a</td><td>b</td><td>c</td></tr>\n";
foreach($ary['a'] as $m) {
foreach($ary['b'] as $n) {
foreach($ary['c'] as $v) {
echo "<tr><td>$m</td><td>$n</td><td>$v</td></tr>\n";
}
}
}
echo "</table>";
<tr><td>a</td><td>b</td><td>c</td></tr>
<tr><td>a1</td><td>b1</td><td>c1</td></tr>
<tr><td>a1</td><td>b1</td><td>c2</td></tr>
<tr><td>a1</td><td>b2</td><td>c1</td></tr>
<tr><td>a1</td><td>b2</td><td>c2</td></tr>
<tr><td>a2</td><td>b1</td><td>c1</td></tr>
<tr><td>a2</td><td>b1</td><td>c2</td></tr>
<tr><td>a2</td><td>b2</td><td>c1</td></tr>
<tr><td>a2</td><td>b2</td><td>c2</td></tr>
</table>
/code]
------解决方案--------------------
精华区 迪尔卡积 我问的问题....前后几篇 很完整了