Rename: change the file and folder name. The rename () command can be used to rename a file folder and move files and folders. the command format is boolrename (stringoldname, stringnewna rename () the command can be used to rename a file folder and move files and folders. the command format is as follows:
Bool rename (stringOldname,StringNewname [, 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 ):
$ 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 too small and fatal ..............................
The http://www.bkjia.com/PHPjc/478824.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478824.htmlTechArticlerename () command can realize the renaming operation of the file folder, but also can realize the movement operation of the file and folder, the command format is: bool rename (string oldname, string newna...