The rename () command can be used to rename the file folder, and can also be used to move files and folders, in the following format:
bool Rename (string oldname, string newname [, Resource context] )
The following shows the specific application of rename:
File location
Objective: 1. Rename Cache.txt to Rename.txt;
2. Rename Cache2.txt to Cache3.txt
3. Rename the HTML directory to cache
4. Transfer the file directory to the HTML directory (can be renamed)
Code implementation (with error):
$file = "Html/cache.txt";
$rename = "Html/rename.txt";
if (rename ($file, $rename)) {
echo "renamed successfully";
}else{
echo "Renaming failed";
}
Rename ("Html/cache2", "html/cache3.txt");
Rename ("HTML", "cache");
Rename ("File", "Html/files");
?>
Common Error Analysis:
Check the syntax, no problem; The file directory does not exist, resulting in an error. More files compiled successfully
This error is small, deadly ............... ........
http://www.bkjia.com/PHPjc/478824.html www.bkjia.com true http://www.bkjia.com/PHPjc/478824.html techarticle the rename () command can be used to rename the file folder, and can also be used to move files and folders, with the following command format: BOOL Rename (string oldname, String Newna ...