时间戳:Unix 纪元(0:00:00 January 1, 1970 GMT)起到现在的秒数。
最常用的秒级:
time();
返回10位数 1234567890
毫秒,和js的new Date().getTime()对应:
function getMillisecond() {
list($s1, $s2) = explode(' ', microtime());
return (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000);
}
//返回13位 1234567890123
微秒,同上方法,用于精确:
function get_millisecond()
{
list($usec, $sec) = explode(" ", microtime());
$msec=round($usec*1000);
return $msec;
}
//返回16位 1234567890123123
附说明:
echo microtime();
//输出结果是
//0.12312300 1234567890
//实际上
//1234567890秒.12312300微秒
理解了。