Touch(touch函式)

touch -- 設定檔案的訪問和修改時間。

概述,說明,例子,

概述

(PHP 3, PHP 4, PHP 5)
touch -- 設定檔案的訪問和修改時間

說明

bool touch( string filename [, int time [, int atime]] )
嘗試將由 filename給出的檔案的訪問和修改時間設定為給出的時間。如果沒有給出可選參數 time,則使用當前時間。這和 utime(有時也叫做 utimes)所作的等價。如果給出了第三個參數 atime,則給定檔案的訪問時間會被設為 atime。注意訪問時間總是會被修改的,不論有幾個參數。
如果檔案不存在,則會被創建。如果成功則返回 TRUE,失敗則返回 FALSE

例子

]touch() 例子b]
<?php
if (touch($FileName)) {
echo "$FileName modification time has been changed to present time";
} else {
echo "Sorry, could not change modification time of $FileName";
}
?>

相關詞條

熱門詞條

聯絡我們