我想比较来自网址的时间:
$expireTime = $_GET['st']; //the parameter is made like: time() + 3600;
if(time() <= $expireTime){
print_r('valid time');
} else {
throw new Exception("Time expired");
}
但总是时间过期了。
答案 0 :(得分:0)
请使用以下内容。
$expireTime = $_GET['st']; //the parameter is made like: time() + 3600;
$expiretime = strtotime($expireTime);
if(time() <= $expiretime){
print_r('valid time');
}
else {
throw new Exception("Time expired");
}