CakeFest 2024: The Official CakePHP Conference

RarEntry::getName

(PECL rar >= 0.1)

RarEntry::getNameエントリの名前を取得する

説明

public RarEntry::getName(): string

アーカイブエントリの名前 (パスつき) を返します。

パラメータ

この関数にはパラメータはありません。

戻り値

エントリ名を表す文字列、あるいはエラー時に false を返します。

変更履歴

バージョン 説明
PECL rar 2.0.0 バージョン 2.0.0 以降、返される文字列のエンコードは Unicode/UTF-8 となりました。

例1 RarEntry::getName() の例

<?php

// このサンプルは、ページが UTF-8 でエンコードされていなくても安全です。
// UTF-8 でエンコードされているページの場合は mb_convert_encoding は不要です。

$rar_file = rar_open('example.rar') or die("Rar アーカイブのオープンに失敗しました");

$entry = rar_entry_get($rar_file, 'Dir/file.txt') or die("そのようなエントリは見つかりません");

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

?>

add a note

User Contributed Notes

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