note 129464 added to phardata.extractto
| From: | Daniel | Date: | Sun, 05 May 2024 15:22:16 +0000 |
| Subject: | note 129464 added to phardata.extractto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221316@lists.php.net to get a copy of this message | ||
This is an example of how to decompress and unarchive a TAR.GZ file using Phar decompress() and
extractTo() methods:
<?php
echo '<h1>TAR.GZ decompress</h1>';
$file_name = 'your_file.tar.gz';
$tar_file_name = str_replace('.gz', '', $file_name);
$dir_file_name = str_replace('.tar.gz', '', $file_name);
// decompress from gz and creates your_file.tar
$p = new PharData($file_name);
$p->decompress();
// unarchive from the tar to folder 'your_file'
$phar = new PharData($tar_file_name);
$phar->extractTo($dir_file_name);
echo '<h1>DONE</h1>';
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.13.131 (proxied: 189.55.175.194)
----
Manual Page -- https://php.net/manual/en/phardata.extractto.php
Edit -- https://main.php.net/note/edit/129464
Del: integrated -- https://main.php.net/note/delete/129464/integrated
Del: useless -- https://main.php.net/note/delete/129464/useless
Del: bad code -- https://main.php.net/note/delete/129464/bad+code
Del: spam -- https://main.php.net/note/delete/129464/spam
Del: non-english -- https://main.php.net/note/delete/129464/non-english
Del: in docs -- https://main.php.net/note/delete/129464/in+docs
Del: other reasons-- https://main.php.net/note/delete/129464
Reject -- https://main.php.net/note/reject/129464
Search -- https://main.php.net/manage/user-notes.php