The example in this article describes the method of php deleting empty directories. Share it with everyone for your reference. The specific analysis is as follows:
You can delete an empty directory through the rmdir() function in php
<?php if (file_exists("/temp/test")) { rmdir("/temp/test"); print("Directory removed.\n"); } else { print("Directory does not exist.\n"); } ?>
The above code will return
when executed for the first timeDirectory removed.
The second execution will return
because the directory has been deleted.Directory does not exist.
I hope this article will be helpful to everyone’s PHP programming design.