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 /
* /