The unlink() function deletes files, the mkdir() function creates a directory, and the rmdir() function deletes a directory
Copy code The code is as follows:
unlink() function usage example
< ;?
//Use the unlink function to delete the file
$filename="data.txt"; //Define the variable
unlink($filename); //Use the unlink function to delete the file, the filename here should be Relative address, that is to say, delete data.txt in the current web page directory. Returns TRUE on success, FALSE on failure.
//When I just used the unlink function on the server today, I reported an error when using a relative address. The file could not be found, so I changed it to an absolute address and deleted it! The local machine is window and the server is lunix. For the time being, the relative address is used under window and the absolute address is used under lunix! Everyone, please try it and see if this is the case, please help confirm!
mkdir() function usage example
//Use the mkdir function to create a directory
$dirname="mydir"; //Define variables
mkdir($dirname ,0700); //Use mkdir to create a directory. The directory here is also relative. Create a directory named "mydir" under the directory of this web page! Returns TRUE on success, FALSE on failure.
//When I just used the unlink function on the server today, I reported an error when using a relative address. The file could not be found, so I changed it to an absolute address and deleted it! The local machine is window and the server is lunix. For the time being, use relative addresses under window and absolute addresses under lunix! Everyone, please try it and see if this is the case, please help confirm!
?>
rmdir() function usage example< ;/title>
//Use the rmdir function to delete the directory
$dirname="mydir"; //Define variables
rmdir($dirname); //Use rmdir to delete the directory. The directory here is also relative, that is, delete a directory named "mydir" under the directory of this web page! Returns TRUE on success, FALSE on failure.
//When I just used the unlink function on the server today, I reported an error when using a relative address. The file could not be found, so I changed it to an absolute address and deleted it! The local machine is window and the server is lunix. For the time being, use relative addresses under window and absolute addresses under lunix! Everyone, please try it and see if this is the case, please help confirm!
?>
Haha, simple application! The system always has to upload pictures, documents, etc., but the background management only deletes the records without deleting the actual uploaded pictures. Now the server is very bloated. It used to be easy to delete the specified files, just use the unlink function!
http://www.bkjia.com/PHPjc/326429.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/326429.htmlTechArticle The unlink() function deletes files, the mkdir() function creates a directory, and the rmdir() function deletes the directory. Copy the code. The code is as follows : html head titleunlink() function usage example/title /head body ? //Use u...