php使用循环输出一个5行4列的表格.(提示:可嵌入html代码实现)
4个回答
展开全部
<渗喊?php
$hang = 5;
$lie = 4;
echo "<table>";
for($h = 1; $h<=$hang; $h++){
echo "<tr>";
for($l = 1; $l<=$lie; $l++){
echo "穗闭<td>$h行$l列丛族野</td>";
}
echo "</tr>";
}
echo "</table>";
?>
$hang = 5;
$lie = 4;
echo "<table>";
for($h = 1; $h<=$hang; $h++){
echo "<tr>";
for($l = 1; $l<=$lie; $l++){
echo "穗闭<td>$h行$l列丛族野</td>";
}
echo "</tr>";
}
echo "</table>";
?>
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<html><meta charset="首隐utf-8"毁芹纤>
<?php
echo "<table>";
for ($i=1; $i<=5; $i++){
echo "<tr>";
for ($j=1; $j<=4; $j++){
echo "<td>"纤仿.$i."行".$j."列</td>";
}
echo "</tr>";
}
echo "</table>";
?>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<style type="text/css">
td{border:1px solid red;}</style><?php$hang = 5;$lie = 4;echo "<table>";for($h = 1; $h<=$hang; $h++){ echo "宽亏<tr>"; for($l = 1; $l<=$lie; $l++){ echo "<td>".$h."行".$l."列</td>"; } echo "</慎悔神tr>";}echo "<前漏/table>";?>
td{border:1px solid red;}</style><?php$hang = 5;$lie = 4;echo "<table>";for($h = 1; $h<=$hang; $h++){ echo "宽亏<tr>"; for($l = 1; $l<=$lie; $l++){ echo "<td>".$h."行".$l."列</td>"; } echo "</慎悔神tr>";}echo "<前漏/table>";?>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<?php
$hang = 5;
$lie = 4;
echo "<table border='差仔2'>";
for($h = 1; $h<=$hang; $h++){
echo "<tr>";
for($l = 1; $l<=$lie; $l++){
echo "<td>"."$h".'行'."$l".'列'."<银运/td>";
}
echo "<虚搏汪/tr>";
}
echo "</table>";
?>
$hang = 5;
$lie = 4;
echo "<table border='差仔2'>";
for($h = 1; $h<=$hang; $h++){
echo "<tr>";
for($l = 1; $l<=$lie; $l++){
echo "<td>"."$h".'行'."$l".'列'."<银运/td>";
}
echo "<虚搏汪/tr>";
}
echo "</table>";
?>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询