How to clear the Computer cache php folder Delete, PHP clear Cache program

Source: Internet
Author: User
Copy CodeThe code is as follows:


Header (' Content-type:text/html;charset=utf-8 ');
function Delfile ($fpath) {
$filesize = Array ();
$filepath = Iconv (' gb2312 ', ' utf-8 ', $fpath);
if (Is_dir ($fpath)) {
if ($dh = Opendir ($fpath)) {
while (($file = Readdir ($DH))!== false) {
if ($file! = '. ' && $file! = ' ... ') {
$filesize [] = Delfile ($fpath. ' /'. $file);
}
}
Closedir ($DH);
}
/*
* Convenient Statistics Directory number
*/
$filesize [' file '] = 0;
if (@rmdir ($fpath) = = = True) {
echo "{$filepath} ..... ....." Delete Succeeded
\ n ";
} else {
echo "{$filepath} ..... ....." Delete failed
\ n ";
}
} else {
if (Is_file ($fpath)) {
$filesize [] = $fsize = FileSize ($fpath);
if (@unlink ($fpath) = = = True) {
echo "{$filepath} ... {$fsize} K................ Delete Succeeded
\ n ";
} else {
echo "{$filepath} ... {$fsize} K................ Delete failed
\ n ";
}
}
}
return $filesize;
}
/*
* Function Getarrsum (array & $arr) Arrays summation
* Array & $arr processed arrays
*/
Function Getarrsum (& $arr) {
if (Is_array ($arr)) {
foreach ($arr as & $value) {
$value = Getarrsum ($value);
}
Return Array_sum ($arr);
} else {
return $arr;
}
}
$fpath = ' d:/test ';
$filesize = Delfile ($fpath);
$size = Getarrsum ($filesize);
printf (' Save for You:%.3fm space ', $size/(1024*1024));
?>


Just build a test folder under D, and then you can test it with a little something inside.

The above describes how to clear the Computer cache php folder Delete, PHP clear the cache program, including how to clear the computer cache content, I hope that the PHP tutorial interested friends 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.