Why does the time obtained on mac do not match the actual situation? The problem now is that filemtime
is the same as 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));
the information I found is that unix has no file creation time, only inode modification time. So in this case, there is no way to know when the file was created?
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.
record a piece of reference material provided downstairs
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); }