Home >Backend Development >PHP Tutorial >Usage of php mkdir() function

Usage of php mkdir() function

怪我咯
怪我咯Original
2017-07-06 10:28:441704browse

This article mainly introduces the usage of mkdir function in php. It analyzes the method of mkdir function for directory operations in the form of examples. It has certain reference value. Friends who need it can refer to it

The example of 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 mkdir(

stringdirectory, interpretation permission)dirThe new directory.permissionsOctal number specifies the permissions of a new directory for the new directory.Creates .

mkdir() creates a directory with specified permissions. The permissions are, in the same form as file mode() and

fileperms(), returning true on success, if an error occurs, then Return FALSE.

php sample code is as follows:


Code is as follows:

<?php 
if (mkdir("temp", 0701))  
   print "目录创建成功"; 
?>

//Output: Directory created successfully


Create a directory with full permissions

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

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

Tips and

Comments

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


The code is as follows:

<?php mkdir("testing");?>


The above is the detailed content of Usage of php mkdir() function. For more information, please follow other related articles on the PHP Chinese website!

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