PHP Portal » PHP Handbuch » RarArchive::getEntry

Werbung

RarArchive::getEntry


(PECL rar >= 2.0.0)

RarArchive::getEntry -- rar_entry_getGet entry object from the RAR archive.

Beschreibung

Object oriented style (method):

public RarEntry RarArchive::getEntry ( string $entryname )

Procedural style:

RarEntry rar_entry_get ( RarArchive $rarfile , string $entryname )

Get entry object (file or directory) from the RAR archive.

Hinweis: You can also get entry objects using RarArchive::list.

Parameter-Liste

rarfile

A RarArchive object, opened with rar_open().

entryname

Path to the entry within the RAR archive.

Hinweis: The path must be the same returned by RarEntry::getName.

Rückgabewerte

Returns the matching RarEntry object Im Fehlerfall wird FALSE zurückgegeben..

Beispiele

PHP Code
1
2
3
4
5
6
7
8
9
$rar_arch = RarArchive::open('solid.rar'); if ($rar_arch === FALSE) die("Could not open RAR archive."); $rar_entry = $rar_arch->getEntry('tese.txt'); if ($rar_entry === FALSE) die("Could get such entry"); echo get_class($rar_entry)."\n"; echo $rar_entry; $rar_arch->close();

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

RarEntry
RarEntry for file "tese.txt" (23b93a7a)

PHP Code
1
2
3
4
5
6
7
8
9
$rar_arch = rar_open('solid.rar'); if ($rar_arch === FALSE) die("Could not open RAR archive."); $rar_entry = rar_entry_get($rar_arch, 'tese.txt'); if ($rar_entry === FALSE) die("Could get such entry"); echo get_class($rar_entry)."\n"; echo $rar_entry; rar_close($rar_arch);