RarEntry::getName

(PECL rar >= 0.1)

RarEntry::getName — 항목의 이름 가져오기


설명

public RarEntry::getName(): string

아카이브 항목의 이름(경로 포함)을 반환합니다.


매개변수

이 함수에는 매개변수가 없습니다.


반환 값

항목 이름을 문자열로 반환하거나 오류가 발생하면 false를 반환합니다.


변경 로그

버전 설명
PECL rar 2.0.0 Extended_data가 추가되었습니다.
PECL rar 3.0.0 버전 2.0.0부터 반환된 문자열은 유니코드/UTF-8로 인코딩됩니다.

Examples

예제 #1 RarEntry::getName() 예제

                  
<?php

//this example is safe even in pages not encoded in UTF-8
//for those encoded in UTF-8, the call to mb_convert_encoding is unnecessary

$rar_file = rar_open('example.rar') or die("Failed to open Rar archive");

$entry = rar_entry_get($rar_file, 'Dir/file.txt') or die("Failed to find such entry");

echo "Entry name: " . mb_convert_encoding(
    htmlentities(
        $entry->getName(),
        ENT_COMPAT,
        "UTF-8"
    ),
    "HTML-ENTITIES",
    "UTF-8"
);

?>