开发者

exploring zip archive by PHP

开发者 https://www.devze.com 2022-12-13 18:34 出处:网络
this my code $z = new ZipArchive(); if ($z->open(\'file.zip\')) { for ($i=0; $i<$z->numFiles;$i++) {

this my code

$z = new ZipArchive();

if ($z->open('file.zip')) {

            for ($i=0; $i<$z->numFiles;$i++) {
                $aZipDtls = $z->statIndex($i);
                echo $aZipDtls['name'].'<br>';

            }
     }

it returns

docs/
docs开发者_开发问答/INSTALL.html
docs/auth_api.html
docs/install/
docs/install/index.htm

but i want it return a files tree like that

docs/
 -INSTALL.html
 -auth_api.html
  install
   -index.htm 

to make it ul and li and i want to do this do use the PHP File Tree


You'll have to work that out manually. The zip archive stores the files in a very flat structure, but has knowledge of the structure required when "unzipping".

You will have to work out this structure as you go through the archive. You will need to take a look a string functions to help you do this:

http://php.net/manual/en/ref.strings.php


Perhaps you could use this library, I think it supports listing content. http://www.phpconcept.net/pclzip/man/en/index.php

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号