Looping through the creation of directory methods
This will generate the Image.gif directory
Copy CodeThe code is as follows:
$filepath = "Test/upload/2010/image.gif";
Mk_dir ($filepath);
Looping through the creation of catalogs
function Mk_dir ($dir, $mode = 0755)
{
if (Is_dir ($dir) | | @mkdir ($DIR, $mode)) return true;
if (!mk_dir (DirName ($dir), $mode)) return false;
Return @mkdir ($dir, $mode);
}
The second method:
Copy CodeThe code is as follows:
$filepath = "Test/upload/2010/image.gif";
Createdir (DirName ($filepath));
The next thing you can do is move_uploaded_file!
/*
* Function: Loop Detect and Create folder
* Parameters: $path folder path
Returns
*/
function Createdir ($path) {
if (!file_exists ($path)) {
Createdir (DirName ($path));
mkdir ($path, 0777);
}
}
?>
http://www.bkjia.com/PHPjc/322877.html www.bkjia.com true http://www.bkjia.com/PHPjc/322877.html techarticle Loop Create Directory method this generates the Image.gif directory copy code code as follows: $filepath = "Test/upload/2010/image.gif"; Mk_dir ($filepath);//Cycle Create directory function Mk_di ...