Reputation: 5791
i just want making a system that can open a file in a zip archive like i have archive.zip in this file.text i want make a class to makr this page zip.php?archiver=archive.zip&file=file.text i want this page show me the file.text contents any ideas?
Upvotes: 3
Views: 7971
Reputation: 34214
From the PHP manual: ZipArchive::getFromName(). This is exactly what you need.
<?php
$z = new ZipArchive();
if ($z->open(dirname(__FILE__) . '/test_im.zip')) {
$string = $z->getFromName("mytext.txt");
echo $string;
}
?>
Best wishes,
Fabian
Upvotes: 7
Reputation: 83709
you could probably do this:
http://www.php.net/manual/en/function.ziparchive-getfromname.php
it's a function in http://php.net/manual/en/book.zip.php
Upvotes: 1