Usage of php mkdir() function

怪我咯
Release: 2023-03-12 20:50:01
Original
1682 people have browsed it

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 "目录创建成功"; 
?>
Copy after login

//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");?>
Copy after login


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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!