刚刚看文档,感觉这两个函数很相似,都是根据时间戳返回日期,时间等信息的数组,而且从返回的信息上来看getdate完全可以取代localtime,那么请问localtime存在的意义是什么呢?
刚刚看文档,感觉这两个函数很相似,都是根据时间戳返回日期,时间等信息的数组,而且从返回的信息上来看getdate完全可以取代localtime,那么请问localtime存在的意义是什么呢?
localtime
获取的数组中,年是从 1900 开始的
<code> <?php $localtime = localtime(); $localtime_assoc = localtime(time(), true); //print_r($localtime); print_r($localtime_assoc); ?> <?php $today = getdate(); print_r($today); ?></code>
<code>Array ( [tm_sec] => 37 [tm_min] => 22 [tm_hour] => 3 [tm_mday] => 9 [tm_mon] => 9 [tm_year] => 116 [tm_wday] => 0 [tm_yday] => 282 [tm_isdst] => 0 ) Array ( [seconds] => 37 [minutes] => 22 [hours] => 3 [mday] => 9 [wday] => 0 [mon] => 10 [year] => 2016 [yday] => 282 [weekday] => Sunday [month] => October [0] => 1475983357 ) </code>