rpm_close

Closes an RPM file

说明

bool rpm_close ( resource $rpmr )

rpm_close will close an RPM file pointer.

参数

rpmr
A file pointer resource successfully opened by rpm_open.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

范例

示例 #1 rpm_close example

<?php

$file = "/path/to/file.rpm";
$rpmr = rpm_open($file);

rpm_close($rpmr);

?>

参见

  • rpm_open

rpm_get_tag

Retrieves a header tag from an RPM file

说明

mixed rpm_get_tag ( resource $rpmr , int $tagnum )

rpm_get_tag will retrieve a given tag from the RPM file's header and return it.

参数

rpmr
A file pointer resource successfully opened by rpm_open.

tagnum
The tag number to retrieve from the RPM header. This value can be specified using the list of constants defined by this module.

返回值

The return value can be of various types depending on the tagnum supplied to the function.

范例

示例 #1 rpm_get_tag example

<?php

$file = "/path/to/file.rpm";
$rpmr = rpm_open($file);

$name = rpm_get_tag($rpmr, RPMREADER_NAME);
echo "$name<br>\n";

rpm_close($rpmr);

?>

参见

  • rpm_open
  • rpm_close

rpm_is_valid

Tests a filename for validity as an RPM file

说明

bool rpm_is_valid ( string $filename )

rpm_is_valid will test an RPM file for validity as an RPM file. This is not the same as rpm_open as it only checks the file for validity but does not return a file pointer to be used by further functions.

参数

filename
The filename of the RPM file you wish to check for validity.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

范例

示例 #1 rpm_is_valid example

<?php

$file = "/path/to/file.rpm";

if (rpm_is_valid($file)) {
    echo "File is recognized as an RPM file.<br>\n";
}
else {
    echo "File is not recognized as an RPM file.<br>\n";
}

?>

rpm_open

Opens an RPM file

说明

resource rpm_open ( string $filename )

rpm_open will open an RPM file and will determine if the file is a valid RPM file.

参数

filename
The filename of the RPM file you wish to open.

返回值

If the open succeeds, then rpm_open will return a file pointer resource to the newly opened file. On error, the function will return FALSE.

范例

示例 #1 rpm_open example

<?php

$file = "/path/to/file.rpm";
$rpmr = rpm_open($file);

rpm_close($rpmr);

?>

参见

  • rpm_close

rpm_version

Returns a string representing the current version of the rpmreader extension

说明

string rpm_version ( void )

rpm_version will return the current version of the rpmreader extension.

返回值

rpm_version will return a string representing the rpmreader version currently loaded in PHP.

范例

示例 #1 rpm_version example

<?php

$rpmr_ver = rpm_version();

echo "$rpmr_ver<br />\n";

?>

目录

  • rpm_close — Closes an RPM file
  • rpm_get_tag — Retrieves a header tag from an RPM file
  • rpm_is_valid — Tests a filename for validity as an RPM file
  • rpm_open — Opens an RPM file
  • rpm_version — Returns a string representing the current version of the rpmreader extension