(PHP 4, PHP 5, PHP 7)
touch — �趨�ļ��ķ��ʺ���ʱ��
$filename
[, int $time = time()
[, int $atime
]] ) : bool
���Խ��� 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:
ע�⣺��ͬ�ļ�ϵͳ��ʱ����жϷ��������Dz���ͬ�ġ�
�� PHP 5.3.0 ֮ǰ���� Windows ��Ŀ¼�������ʱ�䡣