In php, you can use the filemtime () function to obtain the file modification time. It can return the last modification time of the file content.
If successful, the time is returned in Unix timestamp format. If it fails, false is returned.
Filemtime (string filename)
Returns the time when the file was last modified. If an error occurs, FALSE is returned. Time is returned in Unix timestamp format and can be used for date ().
The Code is as follows: |
Copy code |
$ A = filemtime ("log.txt "); Echo "modification time:". date ("Y-m-d H: I: s", $ ); |
Filectime (string filename)
Returns the time when the last inode of the file was modified. If an error occurs, FALSE is returned. Time is returned in Unix timestamp format.
The Code is as follows: |
Copy code |
$ A = filectime ("log.txt "); Echo "creation time:". date ("Y-m-d H: I: s", $ ); |
Fileatime (string filename)
Returns the time when the object was last accessed. If an error occurs, FALSE is returned. Time is returned in Unix timestamp format.
The Code is as follows: |
Copy code |
$ A = fileatime ("log.txt "); Echo "modification time:". date ("Y-m-d H: I: s", $ )." |