根据前面的学习,我对这章课后作业的理解可能还不深入,希望得到老师的帮助。
<?php
function xh($l,$c=blue){//$l控制偶数行的颜色,$c控制奇数行的颜色
echo '<table width="800" border="1">';
$i = 1;
while($i < 11){
if($i % 2 == 1){
echo "<tr bgcolor='$c'>";
}else{
echo "<tr bgcolor='$l'>";
}
$j = 1;
while($j < 11){
echo '<td>'.$j.'</td>';
$j++;
}
$i++;
echo '</tr>';
}
echo '</table>';
return;
}
xh(green);
?>
Ask the teacher, how to write the code for the after-school homework of the custom function of the PHP function - PHP Chinese website Q&A - Ask the teacher, how to write the code for the after-school homework of the PHP function's custom function - PHP Chinese website Q&A
Let’s watch and learn.
看了下代码,能实现课后作业的要求,只是有两个报错,把$c=blue和xh(green)改一下,加个双引号就可以了。
$c="blue" xh("green")