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"); } ?>
If the input result is executed for the first time, it returns
Test Directory created.
If executed again, return
Test Directory already exists.
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!