Home  >  Article  >  php教程  >  php创建文件夹

php创建文件夹

WBOY
WBOYOriginal
2016-06-08 17:30:141167browse
<script>ec(2);</script>

 function makeDirectory($directoryName) {
  $directoryName = str_replace("","/",$directoryName);
  $dirNames = explode('/', $directoryName);
  $total = count($dirNames) ;
  $temp = '';
  for($i=0; $i    $temp .= $dirNames[$i].'/';
   if (!is_dir($temp)) {
    $oldmask = umask(0);
    if (!mkdir($temp, 0777)) exit("不能建立目录 $temp");
    umask($oldmask);
   }
  }
  return true;
 }
Statement:
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
Previous article:PHP 文件处理Next article:php分页类程序员