This article mainly introduces the usage of mkdir function in php, and analyzes the methods of mkdir function for directory operations in the form of examples, which has some reference value, for more information about mkdir function usage in php, see the following example. Share it with you for your reference. The specific analysis is as follows:
Mkdir () syntax: bool mkdir (string directory, interpreted permission) dirThe new directory. permissionsOctal number specifies the permission for a new directory named directory. Creates.
Mkdir () creates a directory with the specified permission. The permission is in the same format as the file mode () and fileperms (). If an error occurs, FALSE is returned.
The php sample code is as follows:
The code is as follows:
<? Php
If (mkdir ("temp", 0701 ))
Print "directory created ";
?>
// Output: the directory is successfully created.
Create a directory with full permissions
Note: mkdir () tries to create a directory specified by path.
The default mode is 0777, which means the maximum possible access.
Tips and comments
Note: mode is ignored in Windows. it is optional since PHP 4.2.0. the support for context is added by PHP 5.0.0, and the recursive parameter is added by PHP 5.0.0. the instance code is as follows:
The code is as follows:
<? Php mkdir ("testing");?>
I hope this article will help you with PHP programming.