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

php怎的自定义文件修改时间

WBOY
WBOYOriginal
2016-06-13 12:07:051194browse

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

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

------解决思路----------------------
<br />$time=strtotime('2020-01-01');<br />touch('test.txt',$time);<br />$a=filemtime('test.txt');<br />echo date('y-m-d',$a);<br />


<br />20-01-01<br />

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