Created
December 8, 2020 09:26
-
-
Save mnoskov/93c13af4755ca9818a38ae4bac3d9584 to your computer and use it in GitHub Desktop.
Unzip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!class_exists('ZipArchive')) { | |
echo 'ZipArchive not available!'; | |
} | |
ini_set('memory_limit', -1); | |
ini_set('display_errors', 1); | |
error_reporting(E_ALL); | |
$zip = new ZipArchive; | |
$files = glob('*.zip'); | |
foreach ($files as $file) { | |
$handle = $zip->open($file); | |
if ($handle) { | |
$zip->extractTo(__DIR__); | |
$zip->close(); | |
echo $file . " unzipped\n"; | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment