大网数据广告活动
PHP 语言与运行手册

RarArchive::getComment · Get comment text from the RAR archive

· 52CE 我爱测

RarArchive::getComment -- rar_comment_get — Get comment text from the RAR archive

RarArchive::getComment

rar_comment_get

(PECL rar >= 2.0.0)

RarArchive::getComment -- rar_comment_get — Get comment text from the RAR archive

说明

面向对象风格 (method):

public function RarArchive::getComment(): string

过程化风格:

function rar_comment_get(RarArchive $rarfile): string

Get the (global) comment stored in the RAR archive. It may be up to 64 KiB long.

注意:

This extension does not support comments at the entry level.

参数

rarfile

A RarArchive object, opened with rar_open().

返回值

Returns the comment or null if there is none.

注意:

RAR has currently no support for unicode comments. The encoding of the result of this function is not specified, but it will probably be Windows-1252.

示例

示例 #1 面向对象风格

<?php
$rar_arch = RarArchive::open('commented.rar');
echo $rar_arch->getComment();
?>

以上示例的输出类似于:

This is the comment of the file commented.rar.

示例 #2 过程化风格

<?php
$rar_arch = rar_open('commented.rar');
echo rar_comment_get($rar_arch);
?>

来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
PHP Documentation Group
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。