touch

(PHP 3, PHP 4 >= 4.0.0)

touch -- ファイルの最終更新日をセットする

説明

int touch (string filename, int time)

filenameで指定されたファイルの 最終更新日を、timeで指定された値に セットしようと試みます。オプションのtimeが指定されない場合、 現在時刻を使用します。

ファイルが存在しない場合、ファイルが生成されます。

成功するとTRUE、そうでない場合にFALSEを返します。

例 1touch()の例


if ( touch($FileName) ) {
  print "$FileName modification time has been changed to todays date and time";
} else {
  print "Sorry Could Not change modification time of $FileName";
}