一款php目录无限级创建代码
- */
- function makedirectory($directoryname) {
- $directoryname = str_replace("","/",$directoryname);
- $dirnames = explode('/', $directoryname);
- $total = count($dirnames) ;
- $temp = '';
- for($i=0; $i<$total; $i++) {
- $temp .= $dirnames[$i].'/';
- if (!is_dir($temp)) {
- $oldmask = umask(0);
- if (!mkdir($temp, 0777)) exit("不能建立目录 $temp");
- umask($oldmask);
- }
- }
- return true;
- }