close

語法

mkdir(path,mode,recursive,context)
參數描述
path 必需。規定要創建的目錄的名稱。
mode 必需。規定權限。默認是0777。
recursive 必需。規定是否設置遞歸模式。
context 必需。規定文件句柄的環境。Context 是可修改流的行為的一套選項。

說明

mkdir()嘗試新建一個由path指定的目錄。

默認的mode是0777,意味著最大可能的訪問權。

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


Example #1 mkdir() example
<?php
mkdir("/path/to/my/dir", 0700);
?>

 

Example #2 mkdir() using the recursive parameter
<?php
// Desired folder structure
$structure = './depth1/depth2/depth3/';

// To create the nested structure, the $recursive parameter
// to mkdir() must be specified.

if (!mkdir($structure, 0777, true)) {
die('Failed to create folders...');
}

// ...
?>

arrow
arrow
    全站熱搜

    stockwfj3 發表在 痞客邦 留言(0) 人氣()