计算机纪元 时间戳
In PHP, how to get the epoch timestamp, the number of seconds passed since the epoch?
在PHP中 ,如何获取epoch 时间戳 ,即从epoch以来经过的秒数?
In PHP, you can use the time()
function.
在PHP中 ,您可以使用time()
函数。
ts = time();
To get the microsecond together too as a float number, use the microtime(true)
function.
要将微秒也作为浮点数一起使用,请使用microtime(true)
函数。
ts2 = microtime(true);
Example:
例:
$ php -a
Interactiveshell
php > echo time() . PHP_EOL;
1491473013
php > echo microtime(true) . PHP_EOL;
1491473017.2061
php >
Answered by dtivl.
dtivl回答。
翻译自: https://www.systutorials.com/how-to-get-the-epoch-timestamp-in-php/
计算机纪元 时间戳