PHP- touch()- Funktion
❮ Referenz zum PHP-DateisystemBeispiel
Legt die Zugriffs- und Änderungszeit der angegebenen Datei fest:
<?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;
}
?>
Definition und Verwendung
Die Funktion touch() legt die Zugriffs- und Änderungszeit der angegebenen Datei fest.
Hinweis: Wenn die angegebene Datei nicht existiert, wird sie erstellt.
Syntax
touch(filename, time, atime)
Parameterwerte
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 |
Technische Details
Rückgabewert: | TRUE bei Erfolg, FALSE bei Misserfolg |
---|---|
PHP-Version: | 4.0+ |
PHP-Änderungsprotokoll: | PHP5.3 - |
❮ Referenz zum PHP-Dateisystem