<?<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>?>
php uses recursion to create multi-level directories
The above introduces the use of recursion in PHP to create multi-level directories, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.