A general method for recursively creating multi-level directories in PHP

WBOY
Release: 2016-07-25 08:45:28
Original
890 people have browsed it
  1. /**
  2. *
  3. +------------------------------------------------- -----------------------
  4. * Description Create directory recursively
  5. +------------------------ ------------------------------------------------
  6. * @param string $dir Directory that needs innovation
  7. +--------------------------------------------- --------------------------------
  8. * @return If the directory exists or is created successfully, it returns TRUE
  9. +---- -------------------------------------------------- ----------------
  10. * @author gongwen
  11. +-------------------------------- ---------------------------------------
  12. */
  13. function mkdirs($dir, $mode = 0777){
  14. if (is_dir($dir) || mkdir($dir, $mode)) return TRUE;
  15. if (!mkdirs(address($dir), $mode)) return FALSE;
  16. return mkdir($dir, $mode);
  17. }
copy code

PHP


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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!