Various time for php to read files _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Various time for php to read files. 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 the modification succeeds, the Unix timestamp-based party needs to get the modification of the file in php. we can directly use the filemtime () function to 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:

$ 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:

$ 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:

$ A = fileatime ("log.txt ");

Echo "Modification time:". date ("Y-m-d H: I: s", $ )."

Returns the last modification time of the object content. If it succeeds, the time is Unix timestamp...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.