RAR从字母顺序中提取出PHP

时间:2017-01-05 16:38:00

标签: php rar

$temFile = $_FILES["file"]["tmp_name"];
if($rar = RarArchive::open($tempFile)){

    $files = $rar->getEntries();
}

RarArchive :: open按字母顺序列出文件。

通过操作系统查看普通文件,RAR中的文件列表中有过滤器。但它们都不会以任何方式击败PHP返回的顺序 - > getEntries()。那么班级过滤的位置标准是什么? (我特别需要这些信息)我所谈论的位置是由>返回的每个文件的每个位置属性。 getEntries(),它从0开始按升序排列到RAR中的总条目。

返回示例(查看文件名):

Array
(
    [0] => RarEntry Object
        (
            [rarfile:RarEntry:private] => RarArchive Object
                (
                )

            [position:RarEntry:private] => 0
            [name:RarEntry:private] => f.pdf
            [unpacked_size:RarEntry:private] => 19195
            [packed_size:RarEntry:private] => 14531
            [host_os:RarEntry:private] => 2
            [file_time:RarEntry:private] => 2016-12-26 17:31:30
            [crc:RarEntry:private] => b66e9ea3
            [attr:RarEntry:private] => 32
            [version:RarEntry:private] => 29
            [method:RarEntry:private] => 51
            [flags:RarEntry:private] => 36896
        )

    [1] => RarEntry Object
        (
            [rarfile:RarEntry:private] => RarArchive Object
                (
                )

            [position:RarEntry:private] => 1
            [name:RarEntry:private] => g.pdf
            [unpacked_size:RarEntry:private] => 19195
            [packed_size:RarEntry:private] => 14531
            [host_os:RarEntry:private] => 2
            [file_time:RarEntry:private] => 2016-12-26 17:31:30
            [crc:RarEntry:private] => b66e9ea3
            [attr:RarEntry:private] => 32
            [version:RarEntry:private] => 29
            [method:RarEntry:private] => 51
            [flags:RarEntry:private] => 36896
        )

    [2] => RarEntry Object
        (
            [rarfile:RarEntry:private] => RarArchive Object
                (
                )

            [position:RarEntry:private] => 2
            [name:RarEntry:private] => h.pdf
            [unpacked_size:RarEntry:private] => 95698
            [packed_size:RarEntry:private] => 88300
            [host_os:RarEntry:private] => 2
            [file_time:RarEntry:private] => 2016-12-26 17:31:56
            [crc:RarEntry:private] => 425fbc2e
            [attr:RarEntry:private] => 32
            [version:RarEntry:private] => 29
            [method:RarEntry:private] => 51
            [flags:RarEntry:private] => 36896
        )

    [3] => RarEntry Object
        (
            [rarfile:RarEntry:private] => RarArchive Object
                (
                )

            [position:RarEntry:private] => 3
            [name:RarEntry:private] => i.pdf
            [unpacked_size:RarEntry:private] => 95698
            [packed_size:RarEntry:private] => 88300
            [host_os:RarEntry:private] => 2
            [file_time:RarEntry:private] => 2016-12-26 17:31:56
            [crc:RarEntry:private] => 425fbc2e
            [attr:RarEntry:private] => 32
            [version:RarEntry:private] => 29
            [method:RarEntry:private] => 51
            [flags:RarEntry:private] => 36896
        )

    [4] => RarEntry Object
        (
            [rarfile:RarEntry:private] => RarArchive Object
                (
                )

            [position:RarEntry:private] => 4
            [name:RarEntry:private] => a.pdf
            [unpacked_size:RarEntry:private] => 10865
            [packed_size:RarEntry:private] => 6687
            [host_os:RarEntry:private] => 2
            [file_time:RarEntry:private] => 2017-01-05 12:47:34
            [crc:RarEntry:private] => 13f80676
            [attr:RarEntry:private] => 32
            [version:RarEntry:private] => 29
            [method:RarEntry:private] => 51
            [flags:RarEntry:private] => 36896
        )

    [5] => RarEntry Object
        (
            [rarfile:RarEntry:private] => RarArchive Object
                (
                )

            [position:RarEntry:private] => 5
            [name:RarEntry:private] => b.pdf
            [unpacked_size:RarEntry:private] => 19195
            [packed_size:RarEntry:private] => 14531
            [host_os:RarEntry:private] => 2
            [file_time:RarEntry:private] => 2016-12-26 17:31:30
            [crc:RarEntry:private] => b66e9ea3
            [attr:RarEntry:private] => 32
            [version:RarEntry:private] => 29
            [method:RarEntry:private] => 51
            [flags:RarEntry:private] => 36896
        )

    [6] => RarEntry Object
        (
            [rarfile:RarEntry:private] => RarArchive Object
                (
                )

            [position:RarEntry:private] => 6
            [name:RarEntry:private] => c.pdf
            [unpacked_size:RarEntry:private] => 19195
            [packed_size:RarEntry:private] => 14531
            [host_os:RarEntry:private] => 2
            [file_time:RarEntry:private] => 2016-12-26 17:31:30
            [crc:RarEntry:private] => b66e9ea3
            [attr:RarEntry:private] => 32
            [version:RarEntry:private] => 29
            [method:RarEntry:private] => 51
            [flags:RarEntry:private] => 36896
        )

    [7] => RarEntry Object
        (
            [rarfile:RarEntry:private] => RarArchive Object
                (
                )

            [position:RarEntry:private] => 7
            [name:RarEntry:private] => d.pdf
            [unpacked_size:RarEntry:private] => 19195
            [packed_size:RarEntry:private] => 14531
            [host_os:RarEntry:private] => 2
            [file_time:RarEntry:private] => 2016-12-26 17:31:30
            [crc:RarEntry:private] => b66e9ea3
            [attr:RarEntry:private] => 32
            [version:RarEntry:private] => 29
            [method:RarEntry:private] => 51
            [flags:RarEntry:private] => 36896
        )

    [8] => RarEntry Object
        (
            [rarfile:RarEntry:private] => RarArchive Object
                (
                )

            [position:RarEntry:private] => 8
            [name:RarEntry:private] => e.pdf
            [unpacked_size:RarEntry:private] => 19195
            [packed_size:RarEntry:private] => 14531
            [host_os:RarEntry:private] => 2
            [file_time:RarEntry:private] => 2016-12-26 17:31:30
            [crc:RarEntry:private] => b66e9ea3
            [attr:RarEntry:private] => 32
            [version:RarEntry:private] => 29
            [method:RarEntry:private] => 51
            [flags:RarEntry:private] => 36896
        )

)

0 个答案:

没有答案