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

How to modify file creation time in php

藏色散人
藏色散人Original
2020-07-30 10:35:492793browse

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));
?>

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)

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!

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