<?php
header("Content-type:text/html;charset=utf-8");
/**
* 函數名:createDir
* 說明:建立多級目錄函數
* @param $path string 要建立的目錄
* @param $mode int 建立目錄的模式,在windows下可忽略此模式
*/
function createDir($path,$mode = 0777){
if (is_dir($path)) {
// 如果目錄已經存在,則不建立
echo "該目錄已經存在";
} else {
// 如果目錄不存在,則建立
if (mkdir($path,$mode,true)) {
echo "建立目錄成功";
} else {
echo "建立目錄失敗";
}
}
// 調用建立目前函數
createDir("F:/demo/test");
