Home  >  Article  >  Backend Development  >  How to create multi-level directories in php, php creation_PHP tutorial

How to create multi-level directories in php, php creation_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:01:081013browse

How to create a multi-level directory in php, create a multi-level directory in php

The example in this article describes the method of creating a multi-level directory in php. Share it with everyone for your reference. The specific implementation method is as follows:

<&#63;php
 /*
 写出一个能创建多级目录的PHP函数
 */
 function createdirlist($path,$mode){
   if (is_dir($path)){
   //判断目录存在否,存在不创建
     echo "目录'" . $path . "'已经存在";
  //已经存在则输入路径
   }else{ //不存在则创建目录
      $re=mkdir($path,$mode,true);
  //第三个参数为true即可以创建多极目录
     if ($re){
       echo "目录创建成功";//目录创建成功
     }else{
       echo "目录创建失败";
      }
     }
  }
$path="/a/x/cc/cd"; //要创建的目录
$mode=0755; //创建目录的模式,即权限.
createdirlist($path,$mode);//测试

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/972626.htmlTechArticleHow to create a multi-level directory in php, php creation This article describes how to create a multi-level directory in php. Share it with everyone for your reference. The specific implementation method is as follows: php /* Write a code that can create...
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