Home > Backend Development > PHP Tutorial > PHP uses recursion to create multi-level directories, PHP recursion_PHP tutorial

PHP uses recursion to create multi-level directories, PHP recursion_PHP tutorial

WBOY
Release: 2016-07-12 09:08:34
Original
795 people have browsed it

php uses recursion to create multi-level directories, php recursion

<?<span>php
</span><span>header</span>('Content-type:text/html;charset=utf8'<span>);
</span><span>echo</span> "Loading time:".<span>date</span>('Y-m-d H:i:s'<span>);
</span><span>sleep</span>(5<span>);
</span><span>echo</span> "<br>"<span>;
</span><span>echo</span> "End time:".<span>date</span>('Y-m-d H:i:s'<span>);
</span><span>//</span><span> 多级目录新建</span>
<span>function</span> createFolder(<span>$path</span><span>){
    </span><span>if</span>(!<span>file_exists</span>(<span>$path</span><span>)){
        createFolder(</span><span>dirname</span>(<span>$path</span><span>));
        </span><span>mkdir</span>(<span>$path</span>, 0777<span>);
    }
}

createFolder(</span>"/Library/WebServer/Documents/aa/bb/cc"<span>);
</span>?>
Copy after login

php uses recursion to create multi-level directories

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1053803.htmlTechArticlephp uses recursion to create multi-level directories, php recursion? php header ('Content-type: text/html;charset =utf8' ); echo "Loading time:". date ('Y-m-d H:i:s' ); sleep (5 ); echo "br" ; echo "End...
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