PHP time() 函数
实例
返回当前时间的 Unix 时间戳,并格式化为日期:
<!DOCTYPE html><html><body><?php$t=time();echo($t . "<br>");echo(date("Y-m-d",$t));?></body></html>
定义和用法
time() 函数返回自 Unix 纪元(January 1 1970 00:00:00 GMT)起的当前时间的秒数。
语法
time();
技术细节
| 返回值: | 返回包含当前时间的 Unix 时间戳的整数。 |
|---|---|
| PHP 版本: | 4+ |