PhpRename: change the file and folder name. The command format is: boolrename (stringoldname, stringnewname [, resourcecontext]). The following shows the specific application of rename: file location objective: 1. rename cache.txt to re. the command format is:
Bool rename (string oldname, string newname [, resource context])
The following demonstrates the specific rename application:
File location
Purpose: 1.change cache.txt to rename.txt;
2.change cache2.txtname to cache3.txt
3. rename the html directory to cache
4. transfer the file directory to the html Directory (renamed)
Code implementation (with errors ):
The code is as follows:
$ File = "html/cache.txt ";
$ Rename = "html/rename.txt ";
If (rename ($ file, $ rename )){
Echo "renamed ";
} Else {
Echo "renaming failed ";
}
Rename ("html/cache2", "html/cache3.txt ");
Rename ("html", "cache ");
Rename ("file", "html/files ");
?>
Common Error analysis:
Check the syntax. the file directory does not exist, causing an error. Files compiled successfully
This error is fatal.
Using bool rename (string oldname, string newname [, resource context]) below demonstrates the specific application of rename: Object location objective: 1. rename cache.txt to re...