The role of the rename () function in PHP

zhaozj2021-02-16  91

Friends who are familiar with UNIX should know the shell command MV, which is quite moving with WIN32, and can be renamed while moving. I found that PHP's rename () function is equivalent to MV, but it is not only a simple rename function, and it can also change the path of the file or even the entire directory. For example: $ oldpath ---- file or directory original path $ newpath ---- New defined path then Rename ($ OLDPATH, $ newPath) to complete the file / directory mobile operation After my test, Win32 and Unix PHP4 This feature supports this version. In addition, it seems that the unlink () function is canceled in the Win32 version of PHP4. Then you can use the rename () function to complete the deleted operation, for example: $ path --- File or Directory path $ TMP ---- TMP Directory (/ TMP) Rename ($ PATH, $ TMP) Move to the TMP directory.

转载请注明原文地址:https://www.9cbs.com/read-15805.html

New Post(0)