As we all know, the rename () function can rename files or directories. In fact, it can do a lot of things. If you are familiar with unix, you should know that the shell command mv is similar to win32, and can be renamed while moving. I found that the rename () function of php is equivalent to mv, which is not only SyntaxHighlighter
As we all know, the rename () function can rename files or directories. In fact, it can do a lot of things.
If you are familiar with unix, you should know that the shell command mv is similar to win32, and can be renamed while moving. I found that php's rename () function is equivalent to mv. it not only supports simple renaming, but also changes the path of the file and even the entire directory.
For example:
$ Oldpath ---- original path of the file or directory
$ Newpath ---- new definition path
Rename ($ oldpath, $ newpath) can be used to move the file/directory.
After my tests, both win32 and unix php4 support this function.
In addition, it seems that the win32 version of php4 has canceled the unlink () function. You can also use the rename () function to delete objects. for example:
$ Path ---- file or directory path
$ Tmp ---- tmp Directory (/tmp)
Use rename ($ path, $ tmp) to move the file to the tmp directory.