Compression-php get the contents of RAR file, output to how to parse?

Source: Internet
Author: User
Keywords Compressing extended PHP Array objects
Compressing extended PHP Array objects

Recently there is a requirement: The file name inside the RAR archive, the size to get out, parse into JSON output;
Read the countless information, learned to add php_rar.dll (if it is zip, add php_zip.dll extension), and finally through the program to get the relevant content of RAR, but the content of the contents of the format does not know how to parse into JSON, ask the big God pointing twos.

$rar _file = Rar_open (' 222.rar ') or Die ("Failed to open rar archive"); $entries _list = Rar_list ($rar _file); Header (' Content-type:text/plain ');p rint_r ($entries _list);

Get the following data:

Array (    [0] = rarentry object        (            [rarfile:RarEntry:private] = rararchive object                (                )
            [Position:RarEntry:private] = 0 [Name:RarEntry:private] = tar.php [unpacked_si Ze:RarEntry:private] = 64332 [Packed_size:RarEntry:private] = 11726 [Host_os:RarEntry:priv ATE] = 2 [file_time:RarEntry:private] = 2012-07-09 23:47:06 [crc:RarEntry:private] + 6 9e1487f [Attr:RarEntry:private] = [Version:RarEntry:private] [method:             Rarentry:private] = [Flags:RarEntry:private] = 32928) [1] = = Rarentry Object (  [Rarfile:RarEntry:private] = rararchive Object () [Position:RarEntry:private]             = 1 [Name:RarEntry:private] = upload.php [unpacked_size:RarEntry:private] + 2461 [Packed_size:RarEntry:private] = 1033 [Host_os:RarEntry:private] = 2 [File_time:ra Rentry:private] = 2012-07-09 23:47:06 [Crc:RarEntry:private] = ecc4a20d [Attr:RarEntry:private] = 128 [Version:RarEntry:private] [method:RarEntry:private] = [flags:RarEntry:private            ] = 32928) [2] = = Rarentry object ([rarfile:RarEntry:private] = rararchive Object () [Position:RarEntry:private] = 2 [name:RarEntry:private] = URLUPLOAD.P             HP [Unpacked_size:RarEntry:private] + 1877 [Packed_size:RarEntry:private] = 864 [Host_os:RarEntry:private] = 2 [file_time:RarEntry:private] = 2012-07-09 23:47:06 [crc:r  Arentry:private] = 44a999a9 [Attr:RarEntry:private] = [Version:RarEntry:private] = [Method:RarEntry:private] = [Flags:RarEntry:private] = 32928) [3] = Rar       Entry Object (      [Rarfile:RarEntry:private] = rararchive Object () [Position:RarEntry:private]             = 3 [Name:RarEntry:private] = user.php [unpacked_size:RarEntry:private] + 402 [Packed_size:RarEntry:private] = 222 [Host_os:RarEntry:private] = 2 [file_time:rarent Ry:private] = 2012-07-09 23:47:06 [crc:RarEntry:private] = 22db657e [attr:RarEntry:private ] = [Version:RarEntry:private] [Method:RarEntry:private] = [FL] Ags:RarEntry:private] = 32928))
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.