BlaBla.cn

PHP: Rar - Manual

BlaBla.cn
rar_close > <radius_strerror
Last updated: Wed, 19 Mar 2008

Rar Functions

简介

RAR is a powerful and effective archiver created by Eugene Roshal. This extension uses unRAR library which implements read-only support for Rar archives. Re-creating a RAR/WinRAR archiver using unRAR sources is prohibited by the unRAR license.

More information about RAR and unRAR can be found at » http://www.rarlabs.com/.

需求

要编译本扩展模块无需外部库文件。

运行时配置

本扩展模块在 php.ini 中未定义任何配置选项。

安装

Rar extension is currently available through PECL » http://pecl.php.net/package/rar.

Also you can use the PECL installer to install the Rar extension, using the following command: pecl -v install rar.

You can always download the tar.gz package and install Rar by hand:

Example#1 Rar installation

gunzip rar-xxx.tgz
tar -xvf rar-xxx.tar
cd rar-xxx
phpize
./configure && make && make install

Windows users can download the extension dll php_rar.dll here: » http://snaps.php.net/win32/PECL_STABLE/.

资源类型

There is one resource used in Rar extension: a file descriptor returned by rar_open().

预定义常量

RAR_HOST_MSDOS ( integer)
RAR_HOST_OS2 ( integer)
RAR_HOST_WIN32 ( integer)
RAR_HOST_UNIX ( integer)
RAR_HOST_BEOS ( integer)

范例

Example#2 Rar extension overview example

<?php

$rar_file 
rar_open ( 'example.rar' ) or die( "Can't open Rar archive" );

$entries  rar_list ( $rar_file );

foreach (
$entries  as  $entry ) {
    echo 
'Filename: '  $entry -> getName () .  "\n" ;
    echo 
'Packed size: '  $entry -> getPackedSize () .  "\n" ;
    echo 
'Unpacked size: '  $entry -> getUnpackedSize () .  "\n" ;

    
$entry -> extract ( '/dir/extract/to/' );
}

rar_close ( $rar_file );

?>

This example opens a Rar file archive and extracts each entry to the specified directory.

Table of Contents




rar_close > <radius_strerror
Last updated: Wed, 19 Mar 2008
 
 
BlaBla.cn

© 2005-2008 BlaBla.cn 版权所有