(PHP 4, PHP 5, PHP 7)
touch — 设定文件的访问和修改时间
$filename
   [, int $time = time()
   [, int $atime
  ]] )
   尝试将由 filename
   给出的文件的访问和修改时间设定为给出的 time。
   注意访问时间总是会被修改的,不论有几个参数。
  
如果文件不存在,则会被创建。
filename要设定的文件名。
time
       要设定的时间。如果没有提供参数 time 则会使用当前系统的时间。
      
atime
       如果给出了这个参数,则给定文件的访问时间会被设为
   atime,否则会设置 为time。如果没有给出这两个参数,则使用当前系统时间。
      
   成功时返回 TRUE, 或者在失败时返回 FALSE。
  
| 版本 | 说明 | 
|---|---|
| 5.3.0 | 能够修改 Windows 下目录的最后修改时间。 | 
Example #1 touch() 例子
<?php
if (touch($filename)) {
    echo $filename . ' modification time has been changed to present time';
} else {
    echo 'Sorry, could not change modification time of ' . $filename;
}
?>
Example #2 使用 time 参数的 touch()
<?php
// This is the touch time, we'll set it to one hour in the past.
$time = time() - 3600;
// Touch the file
if (!touch('some_file.txt', $time)) {
    echo 'Whoops, something went wrong...';
} else {
    echo 'Touched file with success';
}
?>
Note:
注意:不同文件系统对时间的判断方法可能是不相同的。
在 PHP 5.3.0 之前无法修改 Windows 下目录的最后修改时间。