mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-07 02:22:48 +08:00
开始通过git升级版本
This commit is contained in:
@@ -53,6 +53,30 @@ class PathTools
|
||||
return $file_path;
|
||||
}
|
||||
|
||||
public static function removeDir($dir_name)
|
||||
{
|
||||
if (!is_dir($dir_name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strpos(strtolower(PHP_OS), 'win') === 0) {
|
||||
$dir_name = static::formatWinPath($dir_name);
|
||||
exec("rd /s /q {$dir_name}", $output);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$handle = opendir($dir_name);
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file != '.' && $file != '..') {
|
||||
is_dir("$dir_name/$file") ? self::removeDir("$dir_name/$file") : unlink("$dir_name/$file");
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
return rmdir($dir_name);
|
||||
}
|
||||
|
||||
public static function mapDir($dir, $callback = null)
|
||||
{
|
||||
$result = [];
|
||||
@@ -74,4 +98,9 @@ class PathTools
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function formatWinPath($content)
|
||||
{
|
||||
return str_replace('/', '\\', $content);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user