Latest web development tutorials

PHP touch () function

PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual

Definition and Usage

touch () function sets the specified file access and modification times.

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

grammar

touch(filename,time,atime)

参数 描述
filename 必需。规定要接触的文件。
time 可选。设置时间。默认设置为当前系统时间。
atime 可选。设置访问时间。如果参数未设置或设置为与 time 参数相同,则默认设置为当前系统时间。


Tips and Notes

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


Examples

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


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual