Rename a directory + a file:
<?php
rename("images","pictures");
rename("/test/file1.txt","/home/docs/my_file.txt");
?>
The rename() function renames a file or directory.
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 |
Return Value: | TRUE on success, FALSE on failure |
---|---|
PHP Version: | 4.0+ |
PHP Changelog: | PHP 5.3.1: Allow renaming files across drives in Windows. PHP 5.0: Can be used with some URL wrappers. |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!