Home > Backend Development > PHP Tutorial > php怎样自定义文件修改时间?

php怎样自定义文件修改时间?

WBOY
Release: 2016-06-23 13:48:50
Original
1356 people have browsed it

我想将某个文件的修改日期改为未来的某一天,如
text.txt   的修改时间为  2020-01-01
即通过 filemtime('text.txt') 得到的时间是 2020-01-01
php用什么函数实现?


回复讨论(解决方案)

<?php     touch('1.txt',1643738522);?>
Copy after login

$time=strtotime('2020-01-01');touch('test.txt',$time);$a=filemtime('test.txt');echo date('y-m-d',$a);
Copy after login


20-01-01
Copy after login

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