forked from comsince/ThinkSNS-4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleancache.php
More file actions
38 lines (33 loc) · 897 Bytes
/
cleancache.php
File metadata and controls
38 lines (33 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
//清文件缓存
$dirs = array('./storage/temp');
//清理缓存
foreach ($dirs as $value) {
rmdirr($value);
echo "<div style='border:2px solid green; background:#f1f1f1; padding:20px;margin:20px;width:800px;font-weight:bold;color:green;text-align:center;'>\"".$value.'" have been cleaned clear! </div> <br /><br />';
}
@mkdir('./storage/temp', 0777, true);
function rmdirr($dirname)
{
if (!file_exists($dirname)) {
return false;
}
if (is_file($dirname) || is_link($dirname)) {
return unlink($dirname);
}
$dir = dir($dirname);
if ($dir) {
while (false !== $entry = $dir->read()) {
if ($entry == '.' || $entry == '..') {
continue;
}
rmdirr($dirname.DIRECTORY_SEPARATOR.$entry);
}
}
$dir->close();
return rmdir($dirname);
}
function U()
{
return false;
}