Home > Backend Development > PHP Tutorial > PHP 高速生成目录树

PHP 高速生成目录树

WBOY
Release: 2016-06-13 13:04:43
Original
1291 people have browsed it

PHP 快速生成目录树

bool mkdir ( string $pathname [, int $mode [, bool $recursive [, resource $context ]]] )
Copy after login


尝试新建一个由 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;   
    }  
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template