Home > Backend Development > PHP Tutorial > How to batch create file directories in php_PHP tutorial

How to batch create file directories in php_PHP tutorial

WBOY
Release: 2016-07-20 11:07:10
Original
1410 people have browsed it

php tutorial batch creation of file directories method
class newFold{
var $upload_dir=date("Y/m/d");
if(!is_dir($this->upload_dir)) {
$this->mkdir_r($this->upload_dir,0777);
}

function mkdir_r($dirName, $rights=0777){
$dirs = explode ('/', $dirName);
$dir='';
foreach ($dirs as $part) {
$dir.=$part.'/';
if (! is_dir($dir) && strlen($dir)>0)
mkdir($dir, $rights);
}
}
}

// How to use

$files = new newFold();

Original .net tutorial on this site">www.bkjia.com


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444976.htmlTechArticlephp tutorial batch creation of file directory method class newFold{ var $upload_dir=date(Y/m/d); if (!is_dir($this-upload_dir)){ $this-mkdir_r($this-upload_dir,0777); } function mkdir_r($dirNam...
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