PHP Doku:: Get full list of entries from the RAR archive - rararchive.getentries.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzErweiterungen zur Datenkompression und ArchivierungRar ArchivingThe RarArchive classRarArchive::getEntries -- rar_list

Ein Service von Reinhard Neidl - Webprogrammierung.

The RarArchive class

<<RarArchive::getComment -- rar_comment_get

RarArchive::getEntry -- rar_entry_get>>

RarArchive::getEntries

rar_list

(PECL rar >= 2.0.0)

RarArchive::getEntries -- rar_listGet full list of entries from the RAR archive

Beschreibung

Object oriented style (method):

public array RarArchive::getEntries ( void )

Procedural style:

array rar_list ( RarArchive $rarfile )

Get entries list (files and directories) from the RAR archive.

Hinweis:

If the archive has entries with the same name, this method, together with RarArchive foreach iteration and array-like access with numeric indexes, are the only ones to access all the entries (i.e., RarArchive::getEntry() and the rar:// wrapper are insufficient).

Parameter-Liste

rarfile

A RarArchive object, opened with rar_open().

Rückgabewerte

rar_list() returns array of RarEntry objects Im Fehlerfall wird FALSE zurückgegeben..

Changelog

Version Beschreibung
3.0.0 Support for RAR archives with repeated entry names is no longer defective.

Beispiele

Beispiel #1 Object oriented style

<?php
$rar_arch 
RarArchive::open('solid.rar');
if (
$rar_arch === FALSE)
    die(
"Could not open RAR archive.");

$rar_entries $rar_arch->getEntries();
if (
$rar_entries === FALSE)
    die(
"Could retrieve entries.");

echo 
"Found " count($rar_entries) . " entries.\n";

foreach (
$rar_entries as $e) {
    echo 
$e;
    echo 
"\n";
}
$rar_arch->close();
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

Found 2 entries.
RarEntry for file "tese.txt" (23b93a7a)
RarEntry for file "unrardll.txt" (2ed64b6e)

Beispiel #2 Procedural style

<?php
$rar_arch 
rar_open('solid.rar');
if (
$rar_arch === FALSE)
    die(
"Could not open RAR archive.");

$rar_entries rar_list($rar_arch);
if (
$rar_entries === FALSE)
    die(
"Could retrieve entries.");

echo 
"Found " count($rar_entries) . " entries.\n";

foreach (
$rar_entries as $e) {
    echo 
$e;
    echo 
"\n";
}
rar_close($rar_arch);
?>

Siehe auch


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)