PHPのrename()関数
❮PHPファイルシステムリファレンス例
ディレクトリとファイルの名前を変更します。
<?php
rename("images","pictures");
rename("/test/file1.txt","/home/docs/my_file.txt");
?>
定義と使用法
rename()関数は、ファイルまたはディレクトリの名前を変更します。
構文
rename(old, new, context)
パラメータ値
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 |
技術的な詳細
戻り値: | 成功した場合はTRUE、失敗した場合はFALSE |
---|---|
PHPバージョン: | 4.0以降 |
PHP変更ログ: | PHP 5.3.1:Windowsのドライブ間でファイルの名前を変更できるようにします。 PHP 5.0:一部のURLラッパーで使用できます。 |
❮PHPファイルシステムリファレンス