This module allows you to read the meta information stored in the headers of a » RedHat Package Manager (» RPM) file.
The RPMReader extension requires PHP 5.
本 » PECL 扩展未绑定于 PHP 中。
安装此 PECL 扩展库的信息可在手册中标题为 PECL 扩展库安装的一章中找到。 更多信息如新版本,下载,源文件,维护者信息以及更新日志等可以在这里找到: » http://pecl.php.net/package/rpmreader.
There is one resource type used by the RPMReader module. The resource is a file pointer which identifies the RPM file with which to work.
以下常量由本扩展模块定义,因此只有在本扩展模块被编译到 PHP 中,或者在运行时被动态加载后才有效。
The following list of constants are used to obtain information using the rpm_get_tag() function. These constants represent the tag number to be retrieved from the RPM file's header section. Descriptions are given below as to what data the tag number constants reference.
This example will open an RPM file and read the name, version, and release from the RPM file, echo the results, and close the RPM file.
Example#1 Basic RPMReader Example
<?php
$filename = "/path/to/file.rpm";
// open file
$rpmr = rpm_open($filename);
// get "Name" tag
$name = rpm_get_tag($rpmr, RPMREADER_NAME);
// get "Version" tag
$ver = rpm_get_tag($rpmr, RPMREADER_VERSION);
// get "Release" tag
$rel = rpm_get_tag($rpmr, RPMREADER_RELEASE);
echo "$name-$ver-$rel<br>\n";
// close file
rpm_close($rpmr);
?>