Home >Backend Development >PHP Tutorial >Example analysis of mkdir function usage in php, mkdir example analysis_PHP tutorial

Example analysis of mkdir function usage in php, mkdir example analysis_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:14:01831browse

Example analysis of mkdir function usage in php, mkdir example analysis

This article analyzes the usage of mkdir function in PHP with examples. Share it with everyone for your reference. The specific analysis is as follows:

mkdir() syntax: bool mkdir (string directory, int permission) dirThe new directory.permissionsOctal number specifies the permissions of a new directory for the new directory.Creates a new directory.

mkdir() creates a directory with specified permissions. The permissions are, in the same form as filemode() and fileperms(), returning true on success and FALSE if an error occurs.

php sample code is as follows:

Copy code The code is as follows:
if (mkdir("temp", 0701))
Print "Directory created successfully";
?>
//Output: Directory created successfully

Create a directory with full permissions

Explanation: mkdir() attempts to create a new directory specified by path.

The default mode is 0777, which means the greatest possible access.

Tips and Notes

Note: mode is ignored under Windows and becomes optional since PHP 4.2.0. Support for context was added in PHP 5.0.0. The recursive parameter was added in PHP 5.0.0. The example code is as follows:

Copy code The code is as follows:

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/912288.htmlTechArticleExample analysis of mkdir function usage in php, mkdir example analysis This article analyzes the usage of mkdir function in php. Share it with everyone for your reference. The specific analysis is as follows: mkdir() syntax: bool mkd...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn