RarArchive::getEntry
rar_entry_get
(PECL rar >= 2.0.0)
RarArchive::getEntry -- rar_entry_get — Get entry object from the RAR archive
Description
Object oriented style (method):
Procedural style:
Get entry object (file or directory) from the RAR archive.
Note:
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.
Parameters
-
rarfile
-
A RarArchive object, opened with rar_open().
-
entryname
-
Path to the entry within the RAR archive.
Note:
The path must be the same returned by RarEntry::getName().
Return Values
Returns the matching RarEntry object or FALSE
on failure.
Examples
Example #1 Object oriented style
<?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 get such entry");
echo get_class($rar_entry)."\n";
echo $rar_entry;
$rar_arch->close();
?>
The above example will output something similar to:
RarEntry RarEntry for file "tese.txt" (23b93a7a)
Example #2 Procedural style
<?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 get such entry");
echo get_class($rar_entry)."\n";
echo $rar_entry;
rar_close($rar_arch);
?>
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для сжатия и архивации
- Архивирование Rar
- Функция RarArchive::close() - Закрывает RAR архив и освобождает все ресурсы
- Функция RarArchive::getComment() - Get comment text from the RAR archive
- Функция RarArchive::getEntries() - Возвращает полный список элемнтов из RAR архива
- Функция RarArchive::getEntry() - Возвращает объект элемента из RAR архива
- Функция RarArchive::isBroken() - Test whether an archive is broken (incomplete)
- Функция RarArchive::isSolid() - Check whether the RAR archive is solid
- Функция RarArchive::open() - Открывает RAR архив
- Функция RarArchive::setAllowBroken() - Whether opening broken archives is allowed
- Функция RarArchive::__toString() - Get text representation
Коментарии
404 Not Found