Funkce PHP rename() .
❮ Reference souborového systému PHPPříklad
Přejmenujte adresář + soubor:
<?php
rename("images","pictures");
rename("/test/file1.txt","/home/docs/my_file.txt");
?>
Definice a použití
Funkce rename() přejmenuje soubor nebo adresář.
Syntax
rename(old, new, context)
Hodnoty parametrů
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 |
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.1: Povolení přejmenování souborů mezi disky ve Windows. PHP 5.0: Lze použít s některými obaly URL. |
❮ Reference souborového systému PHP