F::unzip PHP Méthode

unzip() public static méthode

Unzips a zip file
public static unzip ( string $file, string $to ) : boolean
$file string
$to string
Résultat boolean
    public static function unzip($file, $to)
    {
        if (!class_exists('ZipArchive')) {
            throw new Exception('The ZipArchive class is not available');
        }
        $zip = new ZipArchive();
        if ($zip->open($file) === true) {
            $zip->extractTo($to);
            $zip->close();
            return true;
        } else {
            return false;
        }
    }