UK [mk'dɪər] US [mk'dɪr]

n.DOS command: Create a new subdirectory


php mkdir() function syntax

Function: Create a directory.

Syntax: mkdir(path,mode,recursive,context)

Parameters:

ParameterDescription
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 "目录创建失败";
}
?>