PHP rename()Functions


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual

Definition and Usage

The rename() function renames a file or directory.

If successful, the function returns TRUE. If it fails, it returns FALSE.

Syntax

rename(oldname,newname,context)

Parameters Description
oldname Required. Specifies the file or directory to rename.
newname Required. Specifies the new name for the file or directory.
context Optional. Specifies the environment for the file handle. context is a set of options that can modify the behavior of a stream.


Examples

<?php
rename("images","pictures");
?>


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual Other Extensions