Move, copy and delete files

Let’s talk about renaming first. The renaming function is:

Rename the file

bool rename($ Old name, $new name);

This function returns a bool value and changes the old name to the new name.

We open the directory and we can see the effect. You will find that the specified file is copied to the target path.

Copy files

Copying files is equivalent to cloning technology, cloning an original thing into a new thing. Both look exactly the same.

bool copy(source file, target file)

Function: Copy the source file with the specified path to the location of the target file.

Let’s play it through experiments and code:

Summary:
You will find that there is an extra file through the above example.

Delete file

Deleting a file means deleting a file in the specified path, but this deletion is direct deletion. If you are using a Windows computer, you cannot see this file in the Recycle Bin.

You will only find that this file has disappeared.

bool unlink(file with specified path)


Continuing Learning
||
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!