在mac上獲取到的時(shí)間和實(shí)際情況為何不符?現(xiàn)在問題是,filemtime和filectime一樣了
echo date('Y-m-d H:i:s', filemtime($file));
echo date('Y-m-d H:i:s', filectime($file));
echo date('Y-m-d H:i:s', fileatime($file));
自己搜到的資料,說是unix沒有文件創(chuàng)建時(shí)間,只有inode修改時(shí)間。那么這種情況下就沒辦法知道文件的創(chuàng)建時(shí)間了嗎?
https://stackoverflow.com/que...
Use filectime. For Windows it will return the creation time, and for Unix the change time which is the best you can get because on Unix there is no creation time (in most filesystems).Note also that in some Unix texts the ctime of a file is referred to as being the creation time of the file. This is wrong. There is no creation time for Unix files in most Unix filesystems.
記錄一條,樓下提供的參考資料
http://php.net/manual/zh/func...If you need file creation time on Mac OS X:
<?php
if ($handle = popen('stat -f %B ' . escapeshellarg($filename), 'r')) {
$btime = trim(fread($handle, 100));
echo strftime("btime: %Y.%m.%d %H:%M:%S\n", $btime);
pclose($handle);
}
本地時(shí)間正確
2 回答

月關(guān)寶盒
TA貢獻(xiàn)1772條經(jīng)驗(yàn) 獲得超5個(gè)贊
filemtime 獲取 最后修改時(shí)間這個(gè)是正常的. 只是一個(gè)是24小時(shí)制, 一個(gè)是12小時(shí)制.
filectime 獲取inode修改時(shí)間
fileatime 取得文件的上次訪問時(shí)間
- 2 回答
- 0 關(guān)注
- 456 瀏覽
添加回答
舉報(bào)
0/150
提交
取消