在mac上获取到的时间和实际情况为何不符?现在问题是,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没有文件创建时间,只有inode修改时间。那么这种情况下就没办法知道文件的创建时间了吗?
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);
}
本地时间正确
- 2 回答
- 0 关注
- 435 浏览
添加回答
举报
0/150
提交
取消