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

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

WBOY
WBOYOriginal
2016-06-23 13:48:501286browse

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


回复讨论(解决方案)

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

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


20-01-01

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