下面小编就为大家带来一篇php生成毫秒时间戳的实例讲解。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
php时间函数time()生成当前时间的秒数,但是在一些情况下我们需要获取当前服务器时间和GMT(格林威治时间)1970年1月0时0分0秒的毫秒数,与Java中的currentTimeMilis()函数一样。
例子:
public function getCurrentMilis() { $mill_time = microtime(); $timeInfo = explode(' ', $mill_time); $milis_time = sprintf('%d%03d',$timeInfo[1],$timeInfo[0] * 1000); return $time; }
以上就是php生成毫秒时间戳的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号