在PHP中创建变量等于当前时间减去一小时 [英] Create Variable in PHP Equal to Current Time Minus One Hour
本文介绍了在PHP中创建变量等于当前时间减去一小时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在PHP中,如何创建一个名为$livetime
的变量,该变量等于当前时间减去1小时?
In PHP, how could I create a variable called $livetime
that equals the current time minus 1 hour?
推荐答案
另一种方法-无需所有数学知识,我认为它读起来更好.
Another way - without all the math and, in my opinion, reads better.
$hour_ago = strtotime('-1 hour');
这篇关于在PHP中创建变量等于当前时间减去一小时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文