PHP method example of creating multi-level directories (recursively creating directories)

WBOY
Release: 2016-07-25 08:51:16
Original
1216 people have browsed it
How to create multi-level directories in PHP, example code for creating multi-level directories in PHP, and examples of how to create directories recursively in PHP. Through examples, the specific methods of operating file directories in PHP are introduced.

1. How to create multi-level directories in PHP.

Copy code Code example: 2. PHP code to create multi-level directory

php multi-level directory implementation code:

Copy code Code example:

function createFolder($path) { if (!file_exists($path)) { createFolder(dirname($path));

mkdir($path, 0777); } } createFolder("2007/3/4");//Create the directory structure of 2007/3/4 in the current directory.

3. How to recursively create a directory in php

How to create a directory recursively in PHP, using techniques to create directories recursively, and how to implement the ternary operator

Example, how to create a directory recursively in PHP:

Copy code Code example:

Replaced with ternary operation, the code is as follows:



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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!