当前位置:Gxlcms > PHP教程 > PHP高速生成目录树

PHP高速生成目录树

时间:2021-07-01 10:21:17 帮助过:21人阅读

PHP 快速生成目录树
bool mkdir ( string $pathname [, int $mode [, bool $recursive [, resource $context ]]] )


尝试新建一个由 pathname 指定的目录。

recursive 参数是 PHP 5.0.0 添加的。这个参数很方便,如果将 recursive 设置为 true,mkdir函数会将给定的pathname递归创建好。

下面也给出 php 4 中的解决方法:
function mkdirs($path , $mode = 0755 ){   
        if(!is_dir($path)){   
            mkdirs(dirname($path),$mode);   
            mkdir($path,$mode);   
        }   
        return true;   
    }  

人气教程排行