twlkyao:
[code=php]
function RecursiveMkdir($path,$mode) {
if (!file_exists($path)) { // The file is not exist.
RecursiveMkdir(dirname($path), $mode); // Call itself.
if(mkdir($path, $mode)) { // Call mkdir() to create the last directory, and the result is true.
return true;
} else { // Call mkdir() to create the last directory, and the result is false.
return false;
}
} else { // The file is already exist.
return true;
}
}
[/code]
从而可以判断目录是否递归创建成功。