如何以毫秒的精度获得PHP的时间? [英] How to get time in PHP with nanosecond precision?
本文介绍了如何以毫秒的精度获得PHP的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果没有,可用的最高精度是多少?
解决方案
microtime
功能是您正在寻找的。 p>
PHP不提供精度高于微秒的功能。
您可以使用 系统如果您正在运行Linux,则可以从机器获取值直接
:
$ nanotime = system('date +%s%N');
%s
是由 %N
附加的秒数,这是纳秒的数量。
Is this even possible in PHP?
If not, what is the highest precision available?
解决方案
The microtime
function is what you're looking for.
PHP does not supply a function that has higher precision than microseconds.
You can use the system
function to get the value straight from the machine if you are running Linux:
$nanotime = system('date +%s%N');
%s
is the amount of seconds, appended by %N
, which is the amount of nanoseconds.
这篇关于如何以毫秒的精度获得PHP的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文