現在這是我的代碼包含PHP時間如果擴展
的index.html
<form action="timeout.php" method="POST">
<input type="time" name="txt_time" required>
<input type="submit">
</form>
timeout.php
<?php
$formattedTime = date("h:i A", strtotime($_POST['txt_time']));
$curfew = date("h:i A", strtotime('20:00'));
if($formattedTime > $curfew) {
echo "You are past the curfew time";
} else {
echo "Success";
}
?>
我的問題是,即使我把對exampole 08 :當天上午00時,它仍然說你已經過了宵禁時間。有什麼想法嗎?
所以,如果輸入的是「3:00 PM」或「14:00」要評估,如果那個時候是前一套宵禁?不要使用'str2time()'。 – Twisty
''?在所有瀏覽器上都不支持 – Ghost
@Twisty輸入類型是時間,那麼我應該使用什麼? – FewFlyBy