Support for multi-level directory built PHP function This function PHP Custom function is a path to create a folder and support multi-level directory instance function Oh.
PHP tutorial functions that support multilevel directory creation
This function PHP Custom function is a path to create a folder and support multi-level directory instance function Oh.
* Create_dir (Create folder path, support multi-level directory);
*/
function Create_dir ($dir _adds= ") {
$falg = true;
$dir _adds = Trim ($dir _adds);
if ($dir _adds!= ") {
$dir _adds = str_replace (Array ('//', ' ', ' \ '), '/', $dir _adds);
if (!is_dir ($dir _adds)) {
$temp = explode ('/', $dir _adds);
$cur _dir = ";
for ($i =0; $i<>
$cur _dir. = $temp [$i]. ' /';
if (! @is_dir ($cur _dir)) {
if (! @mkdir ($cur _dir,0777))
$falg = false;
}
}
}
return $falg;
}
}
See a directory to detect and write file functions
function Htm_w (
$w _dir = ",
$w _filename = ",
$w _content = "
){
$dvs = ";
if ($w _dir && $w _filename && $w _content) {
Number of catalog detections
$w _dir_ex = explode ('/', $w _dir);
$w _new_dir = "; Post-processing Write directory
Unset ($dvs, $FDK, $FDV, $w _dir_len);
foreach ((array) $w _DIR_EX as $dvs) {
if (Trim ($DVS) && $dvs! = ' ... ') {
$w _dir_len. = '. /';
$w _new_dir. = $dvs. ' /';
if (! @is_dir ($w _new_dir)) @mkdir ($w _new_dir, 0777);
}
}
Get the number of directories you need to change
foreach ((array) $this->filedir as $FDK = + $FDV) {
$w _content = Str_replace ($FDV, $w _dir_len.str_replace ('.. /', ', $FDV), $w _content);
}
$this->writer ($w _dir $w _filename, $w _content);
}
}
?>
http://www.bkjia.com/PHPjc/444850.html www.bkjia.com true http://www.bkjia.com/PHPjc/444850.html techarticle support for multi-level directory built PHP function This function PHP Custom function is a path to create a folder and support multi-level directory instance function Oh. Support for multi-level directory-based PHP tutorial functions ...