PHP隔行换色输出几行几列表格。

<?php
$table = '';
function PrintTable($rows, $cols)
{
global $table;
$table .= "<table width='700' border='1'>";
for ($i=1;$i<$rows;$i++) {
$color = $i % 2 == 0 ? 'green' : 'orange';
$table .= "<tr bgcolor='$color'>";
for ($j=1;$j<$cols;$j++) {
$table .="<td>xxoo</td>";
}
$table .= "</tr>";
}
$table .= "</table>";
return $table;
}
echo PrintTable(10, 10);
?>
原文地址:https://www.cnblogs.com/zyyweb/p/9657004.html