Create a directory with mkdir there is a bit like dos inside the creation of the directory Oh, the method is very simple, about the deletion of the directory, here with the rmdir, but only delete empty directory, you can not delete files or folders inside the directory, if you want to delete is not empty directory will be removed with a recursive return
PHP Tutorial Create directory with PHP delete directory code
/*
This is a tutorial article, to show you how to use PHP to create a directory to delete the directory method, let's look at the creation of the directory instance. But it's OK to create a directory with Web permissions.
*/
$dir _name = "www.bkjia.com";
if (mkdir ($dir _name))//Create a directory under the current directory Tmp_data
{
echo "Catalog". $dir _name. " Create success! ";
Create a file Tmp.txt in the directory Tmp_data and write some content to it
if ($fp = fopen ($dir _name. ") /www.bkjia.com.txt ", ' a '))
{
if (fwrite ($fp, "put some contenets into file."))
{
echo "
";
echo "in Directory". $dir _name. " Under Create file Tmp.txt ";
}
}
}
Else
{
echo "Failed to create directory!" ";
Exit
}
echo " ";
if (RmDir ($dir _name))//try to delete the directory Tmp_data
{
echo "Delete directory". $dir _name. " Success! ";
}
Else
{
echo "Failed to delete directory!" ";
Exit
}
/*
Summarize:
Create a directory with mkdir there is a bit like dos inside the creation of the directory Oh, the method is very simple, about the deletion of the directory, here with the rmdir, but only delete empty directory, you can not delete files or folders inside the directory, if you want to delete is not empty directory will be removed with a recursive return
*/
http://www.bkjia.com/PHPjc/445437.html www.bkjia.com true http://www.bkjia.com/PHPjc/445437.html techarticle Create a directory with mkdir there is a bit like DOS inside the creation directory Oh, the method is very simple, about the delete directory, here with RmDir, but only delete empty directory, can not delete the file or text inside ...