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

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

WBOY
Release: 2016-06-13 12:07:05
Original
1191 people have browsed it

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

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

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


<br />20-01-01<br />
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