php The mkdir function is used to create a new directory. The syntax of this function is "mkdir(path, mode, recursive, context)". Its parameter "path" represents the name of the directory to be created. The parameter "mode" ” specifies permissions, and the parameter “recursive” specifies setting the recursive mode.
Recommendation: "PHP Video Tutorial"
mkdir() function uses the specified path name to create a new directory. The syntax is mkdir(path,mode,recursive,context), which takes the path and mode as parameters and returns TRUE on success and FALSE on failure. Note: The mode parameter in the mkdir() function is ignored on Windows platforms.
php How to use the mkdir() function?
Function: Create a directory.
Syntax:
mkdir(path,mode,recursive,context)
Parameters:
path: required. Specifies the name of the directory to be created.
mode: Required. Specify permissions. The default is 0777.
recursive: Required. Specifies whether to set recursive mode.
context: Required. Specifies the environment for a file handle. Context is a set of options that modify the behavior of the stream.
Description: Try to create a new directory specified by path. The default mode is 0777, which means maximum possible access.
php mkdir() function example
<?php $dir = mkdir("newFile"); if($dir) { echo "目录创建成功"; }else{ echo "目录创建失败"; } ?>
This article is an introduction to the PHP mkdir function. I hope it will be helpful to friends in need!
The above is the detailed content of How to use php mkdir function. For more information, please follow other related articles on the PHP Chinese website!