Introduction to the usage of unlink(), mkdir(), rmdir(), etc. in php

WBOY
Release: 2016-07-25 09:10:15
Original
1814 people have browsed it
  1. unlink() function usage example
  2. //Use unlink Function to delete files
  3. $filename="data.txt"; //Define variables
  4. 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.
  5. //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

  1. mkdir() function Example</ title></li> <li></head></li> <li><body></li> <li><?<li>//Use the mkdir function to create a directory <li>$dirname="mydir"; //Define variables <li>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. <li>//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! <li>?></li> <li></body></li> <li></html></li> <li> </li> </ol></div> <em onclick="copycode($('code_zNJ'));">Copy code</em> </div> <p> </p> <div class="blockcode"> <div id="code_uz7"><ol> <li> <li> <li><p><html></li> <li><head> ;</li> <li><title> Example of using the rmdir() function
  2. //Use the rmdir function to delete the directory
  3. $dirname="mydir"; //Define variables
  4. 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.
  5. //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!
  6. ?>
  7. , 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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template