Note that getFromIndex returns false for directories.
ZipArchive::getFromIndex
(PHP 5 >= 5.2.0, PECL zip >= 1.3.0)
ZipArchive::getFromIndex — Devuelve el contenido de la entrada usando su índice
Descripción
Devuelve el contenido de la entrada usando su índice.
Parámetros
- index
-
El índice de la entrada
- length
-
La longitud que se see desde la entrada. Si es 0, entonces toda la entrada se lee.
- flags
-
Las flags usadas para abrir el fichero. Los siguientes valores pueden ser Ored.
-
ZIPARCHIVE::FL_UNCHANGED
-
ZIPARCHIVE::FL_COMPRESSED
-
Valores devueltos
Devuelve el contenido de la entrada si se ejecutó con éxito o FALSE en caso de error.
Ejemplos
Example #1 Obtener el contenido del fichero
<?php
$zip = new ZipArchive;
if ($zip->open('test.zip') === TRUE) {
echo $zip->getFromIndex(2);
$zip->close();
} else {
echo 'falló';
}
?>
jana.vasseru
17-Aug-2007 11:26
Clay Loveless
18-Mar-2007 05:44
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]])
