php 循环应用
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<table align="center" width="80%" border="1">
<caption><h2>使用while循环嵌套输出表格</h2></caption>
<?php
$out=0;
while($out<10){
$aa= $out%2==0 ? "#ffffff" : "#dddddd";
echo "<tr bgcolor= $aa>";
//echo "<tr bgcolor=".$aa.">";
$in=0;
while($in<10){
echo "<td>".($out*10+$in)."</td>";
$in++;
}
echo "</tr>";
$out++;
}
?>
</table>
</body>
</html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<table align="center" width="80%" border="1">
<caption><h2>使用while循环嵌套输出表格</h2></caption>
<?php
$out=0;
while($out<10){
$aa= $out%2==0 ? "#ffffff" : "#dddddd";
echo "<tr bgcolor= $aa>";
//echo "<tr bgcolor=".$aa.">";
$in=0;
while($in<10){
echo "<td>".($out*10+$in)."</td>";
$in++;
}
echo "</tr>";
$out++;
}
?>
</table>
</body>
</html>
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。
- 上一篇: unity-iPhoneX适配
- 下一篇: QT生成excel文件