The example in this article describes the method of php implementing the creation of 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"); } ?>
Input result If it is the first execution, return
Test Directory created.
If executed again, return
Test Directory already exists.
I hope this article will be helpful to everyone’s PHP programming design.