Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Zip File Functions : ZipArchive::getFromIndex

ZipArchive::getFromIndex

Returns the entry contents using its index. ()
mixed ZipArchive::getFromIndex ( int index [, int flags] )

Example 2703. Get the file contents

<?php
$zip
= new ZipArchive;
if (
$zip->open('test.zip') === TRUE) {
   echo
$zip->getFromIndex(2);
   
$zip->close();
} else {
   echo
'failed';
}
?>

Code Examples / Notes » ziparchive_getfromindex

jana.vasseru

Note that getFromIndex returns false for directories.

clay loveless

If you'd like to use this method with the flags listed, you need to specify the length of the entry to retrieve as the second parameter, with the flags as the third parameter.
In otherwords, as indicated in the source:
string getFromIndex(string entryname[, int len [, int flags]])


Change Language


Follow Navioo On Twitter
zip_close
zip_entry_close
zip_entry_compressedsize
zip_entry_compressionmethod
zip_entry_filesize
zip_entry_name
zip_entry_open
zip_entry_read
zip_open
zip_read
ZipArchive::addEmptyDir
ZipArchive::addFile
ZipArchive::addFromString
ZipArchive::close
ZipArchive::deleteIndex
ZipArchive::deleteName
ZipArchive::extractTo
ZipArchive::getArchiveComment
ZipArchive::getCommentIndex
ZipArchive::getCommentName
ZipArchive::getFromIndex
ZipArchive::getFromName
ZipArchive::getNameIndex
ZipArchive::getStream
ZipArchive::locateName
ZipArchive::open
ZipArchive::renameIndex
ZipArchive::renameName
ZipArchive::setArchiveComment
ZipArchive::setCommentIndex
ZipArchive::setCommentName
ZipArchive::statIndex
ZipArchive::statName
ZipArchive::unchangeAll
ZipArchive::unchangeArchive
ZipArchive::unchangeIndex
ZipArchive::unchangeName
eXTReMe Tracker