linux - php uses the filectime function to get the modification time of the file and returns 1970

WBOY
Release: 2023-03-02 12:30:01
Original
2356 people have browsed it

Environment: CentOS6.5
Use php to get the modification time of the file. The result is 1970. Why is this?
Code:

<code>$handler=opendir(dirname(__FILE__)."/uploadfiles/down");
while($file=readdir($handler)){
    if($file=="." || $file==".."){
        continue;
    }
    echo $file.'-'.date('Y-m-d H:i:s',filectime($file)).'<br/>';
}</code>
Copy after login
Copy after login

Result:

linux - php uses the filectime function to get the modification time of the file and returns 1970

But the time of . and .. is normal, I don’t understand

Thank you everyone

Reply content:

Environment: CentOS6.5
Use php to get the modification time of the file. The result is 1970. Why is this?
Code:

<code>$handler=opendir(dirname(__FILE__)."/uploadfiles/down");
while($file=readdir($handler)){
    if($file=="." || $file==".."){
        continue;
    }
    echo $file.'-'.date('Y-m-d H:i:s',filectime($file)).'<br/>';
}</code>
Copy after login
Copy after login

Result:

linux - php uses the filectime function to get the modification time of the file and returns 1970

But the time of . and .. is normal, I don’t understand

Thank you everyone

Use filemtime() to get the last modification time of the file content. The filectime() you use is used to get the last inode modification time of the file.

Path problem...my IQ

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template