PHP rename() Funkcja
❮ Dokumentacja systemu plików PHPPrzykład
Zmień nazwę katalogu + plik:
<?php
rename("images","pictures");
rename("/test/file1.txt","/home/docs/my_file.txt");
?>
Definicja i użycie
Funkcja rename() zmienia nazwę pliku lub katalogu.
Składnia
rename(old, new, context)
Wartości parametrów
Parameter | Description |
---|---|
old | Required. Specifies the file or directory to be renamed |
new | Required. Specifies the new name for the file or directory |
context | Optional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream |
Szczegóły techniczne
Wartość zwrotu: | TRUE w przypadku sukcesu, FALSE w przypadku porażki |
---|---|
Wersja PHP: | 4.0+ |
Dziennik zmian PHP: | PHP 5.3.1: Zezwól na zmianę nazw plików na różnych dyskach w systemie Windows. PHP 5.0: Może być używany z niektórymi opakowaniami adresów URL. |
❮ Dokumentacja systemu plików PHP