mkdir
mkdir
Makes directory
bool **mkdir** string $directory int $permissions bool $recursive $context
Attempts to create the directory specified by .
directory
directoryThe directory path.
tip.fopen-wrapper
permissions
The permissions are 0777 by default, which means the widest possible
access. For more information on permissions, read the details
on the page.
chmod
Opmerking: > is ignored on Windows.
permissions
Note that you probably want to specify the as an octal number,
which means it should have a leading zero. The is also modified
by the current umask, which you can change using
.
`permissions``permissions``umask`
recursive
If true, then any parent directories to the specified will
also be created, with the same permissions.
directory
context
return.success
Opmerking: > If the directory to be created already exists, that is considered an error and false will still be returned. Use or to check if the directory already exists before trying to create it.
is_dir``file_exists
Emits an level error if the directory
already exists.
E_WARNING
Emits an level error if the relevant
permissions prevent creating the directory.
E_WARNING
Voorbeeld: example
<?php
mkdir("/path/to/my/dir", 0700);
?>
Voorbeeld: using the parameter
<?php
// Desired directory structure
$structure = './depth1/depth2/depth3/';
// To create the nested structure, the $recursive parameter
// to mkdir() must be specified.
if (!mkdir($structure, 0777, true)) {
die('Failed to create directories...');
}
// ...
?>
is_dir``rmdir``umask