Delete Directory
Class Del_path
{
function Wm_chief_delpath ($del _path)
{
if (!file_exists ($del _path))//target directory does not exist then establish
{echo "directory does not exist"; return false;}
$hand =opendir ($del _path);
$i = 0;
while ($file =readdir ($hand))
{$i;
if ($i ==1| | $i ==2)
{continue;}
if (! ( STRCHR ($file, ".")))
{
$del _s_path= $del _path. " /". $file;
$this->wm_chief_delpath ($del _s_path);
}
Else
{
$del _file= $del _path. " /". $file;
$this->wm_chief_file ($del _file);
}
}
Closedir ($hand);
$this->wm_chief_path ($del _path);
return true;
}
deleting files
function Wm_chief_file ($del _file)
{
Unlink ($del _file);
}
Delete Directory
function Wm_chief_path ($del _path)
{
RmDir ($del _path);
}
}
$DelPath = "Delpath";//directory to be deleted
$WM _chief=new Del_path ();
$WM _chief_ok= $wm _chief->wm_chief_delpath ($DelPath);
if ($WM _CHIEF_OK)
{
echo "Delete Complete";
}
?>
The above introduces the unlimited upgrade system PHP Delete unlimited directory and file code sharing, including the unlimited upgrade system aspects of the content, I hope the PHP tutorial interested in a friend helpful.