PHP touch() Funkcja
❮ Dokumentacja systemu plików PHPPrzykład
Ustawia czas dostępu i modyfikacji określonego pliku:
<?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;
}
?>
Definicja i użycie
Funkcja touch() ustawia czas dostępu i modyfikacji określonego pliku.
Uwaga: Jeśli określony plik nie istnieje, zostanie utworzony.
Składnia
touch(filename, time, atime)
Wartości parametrów
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 |
Szczegóły techniczne
Wartość zwrotu: | TRUE w przypadku sukcesu, FALSE w przypadku porażki |
---|---|
Wersja PHP: | 4.0+ |
Dziennik zmian PHP: | PHP 5.3 - |
❮ Dokumentacja systemu plików PHP