php获取时间戳
PHP获取时间戳可以使用time()函数,它返回当前时间的Unix时间戳,即从1970年1月1日开始到现在的秒数。
例:
$timestamp = time();
echo $timestamp;
输出:
1619696272
也可以使用strtotime()函数将日期时间字符串转换成时间戳。
例:
$timestamp = strtotime('2022-01-01 00:00:00');
echo $timestamp;
输出:
1640995200
原文地址: https://www.cveoy.top/t/topic/bdiO 著作权归作者所有。请勿转载和采集!