Unlimited Upgrade system PHP Delete unlimited directory and file code sharing

Source: Internet
Author: User
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.

  • Related Article

    Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.