Funkce PHP touch() .
❮ Reference souborového systému PHPPříklad
Nastaví přístup a čas úpravy zadaného souboru:
<?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;
}
?>
Definice a použití
Funkce touch() nastavuje přístup a čas úpravy zadaného souboru.
Poznámka: Pokud zadaný soubor neexistuje, bude vytvořen.
Syntax
touch(filename, time, atime)
Hodnoty parametrů
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 |
Technické údaje
Návratová hodnota: | PRAVDA při úspěchu, NEPRAVDA při neúspěchu |
---|---|
Verze PHP: | 4,0+ |
PHP Changelog: | PHP 5.3 - |
❮ Reference souborového systému PHP