PHP touch()Function


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual

Definition and Usage

The touch() function sets the access and modification time of the specified file.

If successful, the function returns TRUE. If it fails, it returns FALSE.

Syntax

touch(filename,time,atime)

Parameter Description
filename Required. Specifies the file to touch.
time Optional. Sets the time. The default is the current system time.
atime Optional. Sets the access time. If the parameter is not set or is set to the same as the time parameter, the default is the current system time.


Tips and Notes

Note:If the specified file does not exist, it will be created.


Examples

<?php
touch("test.txt");
?>


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual Other Extensions