Let's introduce the mkdir () function:
mkdir ($path, 0777,true);
First parameter: must, represents the path of the multilevel directory to be created;
The second parameter: Set the permissions of the directory, the default is 0777, which means the maximum possible access rights;
The third parameter: True indicates that a multilevel directory is allowed to be created.
Example code (support for creating Chinese catalogs):
Header ("Content-type:text/html;charset=utf-8");
The multilevel directory to create
$path = "dai/php/php learning";
Determine if the directory exists no, there is a hint, does not exist to create the directory
if (Is_dir ($path)) {
echo "Sorry! Directory ". $path. "Already exists! ";
}else{
The third parameter is "true" to indicate that you can create a multilevel directory, iconv prevent Chinese directory garbled
$res =mkdir (Iconv ("UTF-8", "GBK", $path), 0777,true);
if ($res) {
echo "Catalog $path created successfully";
}else{
echo "Directory $path creation failed";
}
}
?>
http://www.bkjia.com/PHPjc/768132.html www.bkjia.com true http://www.bkjia.com/PHPjc/768132.html techarticle let's introduce the mkdir () function: mkdir ($path, 0777,true); First argument: must, represents the path to the multilevel directory to be created; second parameter: Set permissions for the directory, default ...