php循环创建目录_PHP教程

WBOY
Release: 2016-07-13 10:36:38
Original
965 people have browsed it

代码取自thinkphp中:

function mk_dir($dir, $mod = 0777)

{

  if(!is_dir($dir) || mkdir($dir, $mod))

  {

    if(!mk_dir(dirname($dir, $mod)))

    {

      return false;

    }

  }

  return mkdir($dir, $mod);

}

原理:就是不断的尝试创建上层目录,依此类推

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/738510.htmlTechArticle代码取自thinkphp中: function mk_dir($dir, $mod = 0777) { if(!is_dir($dir) || mkdir($dir, $mod)) { if(!mk_dir(dirname($dir, $mod))) { return false; } } return mkdir($dir, $mo...
Related labels:
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!