Update the access time without updating the modified time:
Unix command: touch -a filename
PHP: touch(filename, date('U', filemtime(filename)), time())
touch说明bool touch ( string filename [, int time [, int atime]] )尝试将由 filename 给出的文件的访问和修改时间设定为给出的时间。如果没有给出可选参数 time,则使用当前时间。这和 utime(有时也叫做 utimes)所作的等价。如果给出了第三个参数 atime,则给定文件的访问时间会被设为 atime。注意访问时间总是会被修改的,不论有几个参数。 如果文件不存在,则会被创建。如果成功则返回 TRUE,失败则返回 FALSE。
add a note
User Contributed Notes
Charles Belov
19-Jul-2006 09:10
Update the access time without updating the modified time:
spam at webmastersguide dot com
01-Sep-2005 08:09
If you're going to go around deleting (unlinking) files
rf_public at yahoo dot co dot uk
26-Jul-2005 03:19
Note: the script to touch a file you don't own will change it's owner so ensure permissions are correct or you could lose access to it
guy at forster design dot com
12-May-2005 06:42
Here's a little workaround that allows the PHP user to touch a file it doesn't own:
feathern at yahoo dot com
14-Aug-2002 06:31
Neat little script that will give you a list of all modified files in a certain folder after a certain date:
emilebosch at hotmail dot com
07-Oct-2001 06:41
To spare you ppl couple of hours of valuable time, you can only TOUCH a file that you own! Usually PHP is *nobody*
master at dreamphp dot com
16-May-2001 02:23
$filename = "test.dat";
| |||