As we all know, the rename() function can rename files or directories. In fact, it can do a lot of things.
Friends who are familiar with Unix should know the shell command mv, which is equivalent to win32 movement, and can be renamed while moving. I found that php's rename() function is equivalent to mv. It not only has a simple renaming function, but can also change the path of files or even entire directories.
For example:
$oldpath ---- original path of file or directory
$newpath ---- new defined path
Then rename($oldpath,$newpath) can complete the file / Directory moving operation
After my testing, both win32 and unix php4 versions support this function.
In addition, it seems that the win32 version of php4 has canceled the unlink() function. Then you can also use the rename() function to complete the deletion operation, for example:
$path ---- file or directory path
$tmp ---- tmp directory (/tmp)
Use rename ($path,$tmp) Move the file to the tmp directory.