我使用time()在
PHP中创建时间戳;
我有$current_time和$purchase_time.如何确保purchase_time小于当前时间的24小时?
由于UNIX时间戳只是秒数,所以只需使用差异:
原文链接:https://www.f2er.com/php/133777.html$purchasedToday = $current_time - $purchase_time < 24 * 60 * 60; if ($purchasedToday) { echo 'You just bought the item'; } else { echo 'You bought the item some time ago'; }