function mkdirs($path, $maxdepth, $mode = 0775) { if ($maxdepth <= 0) { return; } $parent = dirname($path); if (!is_dir($parent)) { $this->mkdirs($parent, $maxdepth - 1, $mode); } mkdir($path, $mode); @chmod($path, $mode); }