【发布时间】:2010-08-04 08:35:48
【问题描述】:
我有两次以 7:30:00 和 22:30:00 的格式分别存储在变量 $resttimefrom 和 $resttimeto 中。
我想检查当前时间是否在这两个值之间。我正在用代码检查这个
$time = date("G:i:s");
if ($time > $resttimefrom and $time < $resttimeto ){
$stat = "open";
} else {
$stat = "close";
}
但我总是将 $stat 设为 Close。是什么原因造成的?
【问题讨论】:
-
PHP - Compare Date 的可能重复项
-
因为没有定义$resttimefrom和$resttimeto