I will delete a world in the world file can y help me ? i have this but it not works private function rrmdir($dir) { if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != "." && $object != ".."") { if (is_dir($dir."/".$object)) rrmdir($dir."/".$object); else unlink($dir."/".$object); } } rmdir($dir); } } $this->rmdir("worlds/$arena");
Please use PHP: [PHP] for PHP and Code: [CODE] for your code, otherwise it's pretty much impossible to understand...
PHP: public function deleteLevel(\pocketmine\level\Level $level){ $path = $level->getProvider()->getPath(); unloadLevel($level, true); self::deleteDir($path);}private static function deleteDir($dir) { $files = array_diff(scandir($dir), array('.','..')); foreach($files as $file){ (is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file"); } return rmdir($dir); }