【发布时间】:2021-09-02 10:28:40
【问题描述】:
我是 php 新手,我有解决一项任务的问题。
我必须为学校时间表创建 7 小时的空表(持续时间在 1 行) 周一至周五,1 小时持续 45 分钟(15 分钟休息,2 次休息为 20 分钟,5 次休息为 30 分钟)。
我写了这个,但我不知道如何继续。你能帮我吗?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html">
<title>Task1</title>
</head>
<body>
<?php
header("Content-Type: text/html; charset=windows-1250");
$days = array('Monday', 'Tuesday', 'Wednesday', 'Thurstday', 'Friday');
$times = array('08:00-08:45','09:00-09:45','10:05-10:50','11:05-11:50','12:05-12:50','13:20-14:05','14:20-15:05');
$rows = 5;
$columns = 7;
$i = 0;
$j = 0;
echo "<table border='1'>";
for ($i = 1; $i <= rows; $i++)
{
echo("<tr>");
for ($j = 1; $j <= columns; $j++)
echo "<td>$days[$i]</td>";
$i += 1;
echo("</tr>");
}
echo("</table>");
【问题讨论】:
-
$rows != row(缺少 $)在for ($i = 1; $i <= rows; $i++)中,for ($j = 1; $j <= columns; $j++)相同 -
stackoverflow.com/questions/4977529/… 可能对你有很大帮助
标签: php html arrays netbeans schedule