downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

ZipArchive::getFromName> <ZipArchive::getCommentName
Last updated: Fri, 20 May 2011

view this page in

ZipArchive::getFromIndex

(PHP 5 >= 5.2.0, PECL zip >= 1.3.0)

ZipArchive::getFromIndexDevuelve el contenido de la entrada usando su índice

Descripción

mixed ZipArchive::getFromIndex ( int $index [, int $length = 0 [, int $flags ]] )

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ó';
}
?>


add a note add a note User Contributed Notes ZipArchive::getFromIndex
jana.vasseru 17-Aug-2007 11:26
Note that getFromIndex returns false for directories.
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]])

 
show source | credits | stats | sitemap | contact | advertising | mirror sites