PHP输出毫秒时间戳【转】

代码:

<?php
list($msec, $sec) = explode(' ', microtime());
$msectime = (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
echo $msectime;

?>

输出:

1555923393483

封装成一个方法:

public static function msectime()
{
    list($msec, $sec) = explode(' ', microtime());

    return (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
}

原文链接:https://www.cnblogs.com/lyc94620/p/10751344.html

posted @ 2020-07-01 16:01  小猿笔记  阅读(220)  评论(0编辑  收藏  举报