PHP method to create a directory on the server_PHP tutorial

WBOY
Release: 2016-07-13 10:03:20
Original
1093 people have browsed it

How to create a directory on the server in php

This article mainly introduces the method of creating a directory on the server in php, and analyzes the use of the mkdir function in php with examples. Tips, friends in need can refer to it

The example in this article describes the method of creating a directory on the server in PHP. Share it with everyone for your reference. The specific analysis is as follows:

The following code first determines whether the directory exists, and then creates a directory on the server through the mkdir() function

?

1

2

3

4

5

6

7

8

if (file_exists("/temp/test")) {

print("Test Directory already exists.n");

} else {

mkdir("/temp/test");

print("Test Directory created.n");

}

?>

1 2

3

4

5

6

1

Test Directory created.

7 8

if (file_exists("/temp/test")) {

print("Test Directory already exists.n");

1

Test Directory already exists.

} else {

mkdir("/temp/test");

print("Test Directory created.n");

}

?>

Input result If it is the first execution, return ?
1 Test Directory created.
If executed again, return ?
1 Test Directory already exists.
I hope this article will be helpful to everyone’s PHP programming design. http://www.bkjia.com/PHPjc/968671.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/968671.htmlTechArticleHow to create a directory on the server using php. This article mainly introduces how to create a directory on the server using php. , the example analyzes the skills of using the mkdir function in PHP, what is needed...
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