希望有人能告诉我这个小调试脚本发生了什么。
<?PHP
// function generates the list of times for
function generateTimes($date) {
$currentDate = $date;
echo "RECEIVED CURRENT DATE: " . date("m/d/Y g:iA", $currentDate) . "<br /><br />";
for($i = 0; $i < 48; $i++) {
echo date("g:iA", $currentDate) . "<br />";
$currentDate = mktime(date("g", $currentDate),date("i", $currentDate)+30,0,date("m", $currentDate),date("d", $currentDate),date("Y", $currentDate)); // 30 minutes
}
}
if (isset($_POST['generate_date'])) {
echo "Date Stamp: " . strtotime($_POST['date']) . "<br /><br />";
echo "The time you entered: " . date("r", strtotime($_POST['date'])) . "<br /><br />";
generateTimes($_POST['date']);
}
echo "<form method=post action='timestampgen.php'>";
echo "<input type=text name='date' />";
echo "<input type=submit name='generate_date' value='Generate Time Stamp' />";
echo "</form><br /><br />";
?>
我提交了一个日期,例如 10/1/10 12:00AM,我希望它生成 30 分钟的时间间隔.. 但它似乎不起作用,我认为它与我的 mktime 参数有关
我整天都在做某事,所以这可能是我要疯了。