TimeUtils.php 486 B

123456789101112131415161718192021
  1. <?php
  2. namespace app\common\base\utils;
  3. class TimeUtils {
  4. /**
  5. * 获取时间戳到毫秒
  6. * @return bool|string
  7. */
  8. public static function getMillisecond() {
  9. list($msec, $sec) = explode(' ', microtime());
  10. $msectime = (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
  11. return $msectimes = substr($msectime,0,13);
  12. }
  13. /**
  14. * 获取时间戳到毫秒
  15. * @return bool|string
  16. */
  17. public static function getSecond() {
  18. return time();
  19. }
  20. }