How to clear computer cache php folder deletion, php clear cache program

WBOY
Release: 2016-07-29 08:40:38
Original
1782 people have browsed it

Copy code The 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 for counting the number of directories
*/
$filesize['file'] = 0;
if(@rmdir($fpath) === true) {
echo "{$filepath}............Delete successfully
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 successfully
n";
} else {
echo "{$filepath}...{$fsize}K............Delete failed}
}
}
return $filesize;
}
/*
* function getArrSum(array &$arr) array sum
* array &$arr processed array
*/
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('Saves you: %.3fM Space', $size/(1024*1024));
?>


Just create a test folder under the D drive, and then copy anything into it to test

The above introduces how to clear the computer cache, delete the php folder, and clear the php cache program, including how to clear the computer cache. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template