Don*_*Don 26
if (strtotime("2008-02-16 12:59:57") >= time() - 24 * 60 * 60)
{ /*LESS*/ }
Run Code Online (Sandbox Code Playgroud)
Lir*_*una 20
只需添加另一个答案,使用strtotime相对日期:
$date = '2008-02-16 12:59:57';
if (strtotime("$date +1 day") <= time()) {
// Do something
}
Run Code Online (Sandbox Code Playgroud)
我认为这使代码更具可读性.