How to create a directory on the server in php

墨辰丷
Release: 2023-03-31 18:56:02
Original
1234 people have browsed it

This article mainly introduces the method of creating a directory on the server in PHP. The example analyzes the techniques of using the mkdir function in PHP. Friends who need it can refer to it.

The example of this article describes the implementation of PHP in How to create a directory on the server. 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

<?php
if (file_exists("/temp/test")) {
 print("Test Directory already exists.\n");
} else {
 mkdir("/temp/test");
 print("Test Directory created.\n");
}
?>
Copy after login

If the input result is executed for the first time, it returns

Test Directory created.
Copy after login

If executed again, return

Test Directory already exists.
Copy after login

Summary: The above is the entire content of this article, I hope it will be helpful to everyone's learning.

Related recommendations:

Comparison between PHP serialization function and native serialization function

Generation method of reference implementation tree in PHP

PHP uses phpmailer to send emails

The above is the detailed content of How to create a directory on the server in php. For more information, please follow other related articles on the PHP Chinese website!

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