-
- unlink() function usage example
- //Use unlink Function to delete files
- $filename="data.txt"; //Define variables
- unlink($filename); //Use the unlink function to delete files. The filename here should be a relative address, which means that the file in the current web page directory will be deleted. data.txt is deleted. 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!
-
Copy code
-
- mkdir() function Example title>
- //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!
- ?>
-
Copy code
-
-
-
- Example of using the rmdir() function
- //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!
- ?>
- , without deleting the image file that has actually been uploaded.
Now the server is very bloated. It used to be easy to delete the specified files, just use the unlink function!
-
-
|