Home > Backend Development > PHP Tutorial > Create and delete directories or files

Create and delete directories or files

WBOY
Release: 2016-07-25 09:01:37
Original
982 people have browsed it
Create and delete directories or files ​ ​ ​ ​ ​ ​ ​ ​ ​
                 
                                                                                                                                                                                                                                                                                                       


function mkdirs($directory)
{
             echo $directory;
  1.                                                                                                                                                 77))
  2.                                                                                                                          else
  3.                                                                                                                  return false;
  4. Copy code
  5.                                                                                                                                                                                                                                                                                              


    function delete_directory($directory){
                                                                                                                                                                                                    while ( $ FILENAME = Readdir ($ DH)) {
      IF ($ FILENAME! = "." && $ FILENAME! = "..") {
    1. // is the file. .$filename)){
    2.                                                                                                                                                                                                                                    //Recursively delete subfolders or files if the directory is not empty
    3.                                                                                                                                                     // Recursively delete subfolders or files
    4.                                                   );}}
    5. }} @@Closedir ($ dh);
    6. RMDIR ($ Directory);
    7. }} else {
    8. // Delete a specified file
    9. (File_exist ($ Directory)) {
    10. unlink ($directory);
    11.                                                                                                                           
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