php tutorial to create directory and php delete directory code / * This is a tutorial article, to tell you how to use php to create directory delete directory method, let's take a look at the directory to create an instance of it. But create a directory to have web permissions Caixing ah. * /
$ dir_name = "www.jzread.com";
if (mkdir ($ dir_name)) // Create the directory tmp_data in the current directory { echo "directory." $ dir_name. "created successfully!";
// Create a file tmp.txt in the directory tmp_data and write something to it if ($ fp = fopen ($ dir_name. "/ www.jzread.com.txt", 'a')) { if (fwrite ($ fp, "put some contenets into file.")) { echo "<hr>"; echo "in the directory." $ dir_name. "create file tmp.txt"; } } } else { echo "create directory failed!"; exit } echo "<hr>";
if (rmdir ($ dir_name)) // Try deleting the directory tmp_data { echo "delete directory." $ dir_name. "success!"; } else { echo "delete directory failed!"; exit } / * to sum up: Create a directory with mkdir A bit like dos inside the creation of the directory Oh, the method is very simple, on the delete directory, use rmdir, but only delete empty directory, you can not delete the file or folder directory, if you want to delete is not empty Directory will use recursive to delete / * /
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.