Home > Backend Development > PHP Problem > How to modify file creation time in php

How to modify file creation time in php

藏色散人
Release: 2023-03-03 14:34:01
Original
2834 people have browsed it

php method to modify file creation time: first create a PHP sample file; then enter the code as "touch("test.txt",mktime(19,5,10,10,26,2013)); "; Finally execute the file.

How to modify file creation time in php

Recommended: "PHP Video Tutorial"

php modified file creation time:

For example:

Change the last modification time of test.txt to 19:5:10 on October 26, 2013

<?php
touch("test.txt",mktime(19,5,10,10,26,2013));
?>
Copy after login

touch() function sets the specified file Access and modification times.

If successful, this function returns TRUE. On failure, returns FALSE.

Syntax

touch(filename,time,atime)
Copy after login

Parameters

filename required. Specifies the files to be contacted.

time Optional. Set time. The default setting is the current system time.

atime Optional. Set access time. If the parameter is not set or is set to the same value as the time parameter, it defaults to the current system time.

Tips and Notes

Note: If the specified file does not exist, it will be created.

The above is the detailed content of How to modify file creation time in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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