Delete Unlimited directories and file code sharing _php Tutorial

Source: Internet
Author: User
Delete Directory
This procedure by Wm_chief original, if want to reprint, please indicate author and source (http://www.phome.net)
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";
}

http://www.bkjia.com/PHPjc/313731.html www.bkjia.com true http://www.bkjia.com/PHPjc/313731.html techarticle ?//Delete directory//This program by Wm_chief original, if you want to reprint, please indicate the author and source (http://www.phome.net) Classdel_path {Functionwm_chief_delpath ($del _ Path) {if (!file_exists ($ ...

  • 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.