设置指定文件的访问和修改时间:
<?php
filename = "test.txt";
if (touch($filename)) {
echo $filename . " modification time has been changed to present time";
} else {
echo "Sorry, could not change modification time of " . $filename;
}
?>
touch() 函数设置指定文件的访问和修改时间。
笔记:如果指定的文件不存在,则会创建该文件。
touch(
filename,
time,
atime)
Parameter | Description |
---|---|
filename | Required. Specifies the file to touch |
time | Optional. Sets the touch time. The current system time is set by default |
atime | Optional. Sets the access time. Default is the current system time if no parameters are set, or the same as the time parameter if that parameter is set |
返回值: | TRUE 成功,FALSE 失败 |
---|---|
PHP 版本: | 4.0+ |
PHP 变更日志: | PHP 5.3 - |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!