Last active
March 1, 2021 16:23
-
-
Save vyspiansky/6efa5a231019bea63c3d1c5d8a3e7279 to your computer and use it in GitHub Desktop.
PHP: unzip ZIP file
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 | |
// Path to zip file | |
$file = '...'; | |
// Destination directory for unzipped files | |
$dest = '...'; | |
// Create object | |
$zip = new ZipArchive(); | |
// Open archive | |
if ($zip->open($file) !== true) { | |
die('Could not open archive'); | |
} | |
// Extract contents to destination directory | |
$zip->extractTo($destination); | |
// Close archive | |
$zip->close(); | |
echo 'Archive extracted to directory'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment