PHP touch()関数
❮PHPファイルシステムリファレンス例
指定されたファイルのアクセス時間と変更時間を設定します。
<?php
filename = "test.txt";
if (touch($filename)) {
echo
$filename . " modification time has been changed to present time";
} else {
echo "Sorry, could not change modification time of " . $filename;
}
?>
定義と使用法
touch()関数は、指定されたファイルのアクセス時間と変更時間を設定します。
注:指定されたファイルが存在しない場合は、作成されます。
構文
touch(filename, time, atime)
パラメータ値
Parameter | Description |
---|---|
filename | Required. Specifies the file to touch |
time | Optional. Sets the touch time. The current system time is set by default |
atime | Optional. Sets the access time. Default is the current system time if no parameters are set, or the same as the time parameter if that parameter is set |
技術的な詳細
戻り値: | 成功した場合はTRUE、失敗した場合はFALSE |
---|---|
PHPバージョン: | 4.0以降 |
PHP変更ログ: | PHP5.3- |
❮PHPファイルシステムリファレンス