RarArchive::getEntry

rar_entry_get

(PECL rar >= 2.0.0)

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

Descrierea

Stil obiect-orientat (method):

public RarArchive::getEntry ( string $entryname ) : RarEntry|false

Stil procedural:

rar_entry_get ( RarArchive $rarfile , string $entryname ) : RarEntry|false

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

Notă:

You can also get entry objects using RarArchive::getEntries().

Note that a RAR archive can have multiple entries with the same name; this method will retrieve only the first.

Parametri

rarfile

A RarArchive object, opened with rar_open().

entryname

Path to the entry within the RAR archive.

Notă:

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

Valorile întoarse

Returns the matching RarEntry object sau false în cazul eșecului.

Exemple

Example #1 Stil obiect-orientat

<?php
$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 not get such entry");
echo 
get_class($rar_entry)."\n";
echo 
$rar_entry;
$rar_arch->close();
?>

Exemplul de mai sus va afișa ceva similar cu:

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

Example #2 Stil procedural

<?php
$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 not get such entry");
echo 
get_class($rar_entry)."\n";
echo 
$rar_entry;
rar_close($rar_arch);
?>

A se vedea și

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top