php操作毫秒时间戳

 /** 获取当前时间戳,精确到毫秒 */
function microtime_float()
{
   list($usec, $sec) = explode(" ", microtime());
   return ((float)$usec + (float)$sec);
}
/** 格式化时间戳,精确到毫秒,x代表毫秒 */
function microtime_format($tag, $time)
{
   list($usec, $sec) = explode(".", $time);
   $date = date($tag,$usec);
   return str_replace('x', $sec, $date);
}
posted @ 2017-06-23 10:51  wepe  阅读(298)  评论(0编辑  收藏  举报