Home >Backend Development >PHP Tutorial >PHP function to delete directory_PHP tutorial

PHP function to delete directory_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:00:401088browse

php function to delete directory ​

Example application to delete a file directory:
function scmulu($mlming)
{
$dkml = opendir($mlming);
readdir($dkml);
readdir($dkml);
while(($wj = readdir($dkml))!==false)
{
$wj = $mlming.DIRECTORY_SEPARATOR.$wj;
if(is_dir($wj))
{
scmulu($wj);
}else
{
if(unlink($wj))
{
echo "File$wj was deleted successfully
";
}else
{
echo "File$wjfailed to delete
";
}
}
}
closedir($dkml);
if(rmdir($mlming))
{
echo "Directory$mlming was deleted successfully
";
}else
{
echo "Directory$mlmingfailed to delete
";
}
}


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445501.htmlTechArticlephp function example of deleting a directory is used to delete a directory with files: function scmulu($mlming) { $dkml = opendir($mlming); readdir($dkml); readdir($dkml); while(($wj = readdir($...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn