3

我想使用 PHP MySQL 甚至一点 jQuery 创建一个考勤系统。我想到的规范是让我的所有成员在一个表格行中回显,而在其余部分中,我希望有一个无限的日期数组,但逐月显示。

我只是想知道如何将一个月中的日期动态地放入此表中?有没有人有任何工作示例或指出我正确的方向?

我有一个像这样的迷你布局或查看我的jsFiddle

<form action='this_page.php' method='post'>
<table>
<th>Member</th>
<th>Day One</th>
<th>Day Two</th>
<tr>
    <td>Memeber One</td>
    <td><input type='checkbox' name='student[davidsmith]' value='1' /></td>
            <td><input type='checkbox' name='student[davidsmith]' value='1' /></td>
</tr>
<tr>
    <td>Member Two</td>
    <td><input type='checkbox' name='student[davidsmith]' value='1' /></td>
            <td><input type='checkbox' name='student[davidsmith]' value='1' /></td>
</tr>
</table>
</form>
4

2 回答 2

2

不是 100% 确定你想要什么,但要得到一个月的天数,你可以使用 PHP 的DateTime

例如

$startDate = new DateTime(); //today
$endDate = new DateTime('2013-12-31');

 for ($c = $startDate; $c <= $endDate; $c->modify('+1 day')) {
       echo $c->format('d');
 }

将打印从今天到今年剩余时间的日子,->format('N')用于获取月份名称。在此处查看接受的其他参数format()

于 2013-09-16T14:02:19.383 回答
1

而不是做这个手动工作,它也会让你感到困惑,相反,你可以在开源和免费的应用程序下面:

请试试这个应用程序

于 2013-09-16T14:05:28.030 回答