25 lines
520 B
PHP
25 lines
520 B
PHP
|
<?php
|
||
|
|
||
|
namespace dominion\file;
|
||
|
|
||
|
|
||
|
class Helper
|
||
|
{
|
||
|
public static function delFolder($dir)
|
||
|
{
|
||
|
if (file_exists($dir))
|
||
|
{
|
||
|
$files = array_diff(scandir($dir), array('.', '..'));
|
||
|
foreach ($files as $file)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
(is_dir("$dir/$file")) ? Helper::delFolder("$dir/$file") : unlink("$dir/$file");
|
||
|
}
|
||
|
catch (\Exception $ex){}
|
||
|
}
|
||
|
return rmdir($dir);
|
||
|
}
|
||
|
}
|
||
|
}
|