Phpfileatime? What if the last access time cannot be obtained?

Source: Internet
Author: User
Phpfileatime? What if the last access time cannot be obtained? Php fileatime

$ File = 'image/open1.txt ';
$ Fopen = fopen ($ file, 'r ');
$ Content = fread ($ fopen, filesize ($ file ));
Echo $ content;
Date_default_timezone_set ('Asia/Chongqing ');
Echo date ("Y, m, d, H: I: s", fileatime ($ file ));
Fclose ($ file );
?>
No matter how many times the page is refreshed or accessed again, the page display time remains unchanged at 20:03:31, January 1, December 05, 2013.
Why?


Reply to discussion (solution)

Http://php.net/manual/en/function.fileatime.php

Note:
The atime of a file is supposed to change whenever the data blocks of a file are being read. this can be costly performance-wise when an application regularly accesses a very large number of files or directories.
Some Unix filesystems can be mounted with atime updates disabled to increase the performance of such applications; USENET news spools are a common example. On such filesystems this function will be useless.

Different file systems will be used differently ..

You can try clearstatcache () to clear the cache and then read it.

There is a problem with your code writing. it is clear that the cache and access time remain unchanged.

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.