RarArchive::getEntries

rar_list

(PECL rar >= 2.0.0)

RarArchive::getEntries -- rar_list — RAR 아카이브에서 전체 항목 목록 가져오기


설명

Object-oriented style (method):

public RarArchive::getEntries(): array|false

Procedural style:

rar_list(RarArchive $rarfile): array|false

RAR 아카이브에서 항목 목록(파일 및 디렉토리)을 가져옵니다.

메모: 아카이브에 동일한 이름의 항목이 있는 경우 이 메서드는 RarArchive foreach 반복 및 숫자 인덱스가 있는 배열과 같은 액세스와 함께 모든 항목(즉, RarArchive::getEntry()rar://wrapper가 충분하지 않음).


매개변수

rarfile
rar_open()으로 열린 RarArchive 객체.

반환 값

rar_list()RarEntry 객체의 배열을 반환하거나 실패 시 false를 반환합니다.


변경 로그

버전 설명
PECL rar 3.0.0 항목 이름이 반복되는 RAR 아카이브에 대한 지원은 더 이상 결함이 없습니다.

Examples

예제 #1 객체 지향 스타일

                  
<?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 not retrieve entries.");

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

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

위의 예는 다음과 유사한 결과를 출력합니다.

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

예제 #2 절차 스타일

                  
<?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);
?>
                  
                

기타