編碼的世界 / 優質文選 / 文明

php寫入文本,文件夾不存在則創建


2021年10月18日
-   

// 安全文件路徑,$fileName:完成文件路徑
function securityFilePath($fileName,$read_write = '0777'){
$path = dirname($fileName);
if(!file_exists($path)){// 判斷路徑是否存在,如果不存在則mkdir創建,並寫入權限
mkdir ($path,$read_write,true);
}
}

熱門文章