ZipArchive () output in tree format

Using PHP, I have this list of files that I get:

new ZipArchive(); 

I mean, it is in a zip file.

List of files:

  • docs /
  • docs / INSTALL.html
  • docs / auth_api.html
  • docs / corners_right.gif
  • docs / corners_right.png
  • docs / COPYING
  • docs / corners_left.png
  • docs / bg_header.gif
  • docs / CHANGELOG.html
  • docs / coding-guidelines.html
  • docs / hook_system.html
  • docs / FAQ.html
  • docs / site_logo.gif
  • docs / AUTHORS
  • docs / README.html
  • docs / corners_left.gif
  • docs / stylesheet.css
  • docs / New folder /
  • docs / New folder / New text Document.txt
  • docs / New folder / New folder /

I need a way to cut the dir name from each file path and make it a subcategory.

So the output should look like this:

  docs/ INSTALL.html auth_api.html corners_right.gif corners_right.png COPYING New Folder/ New Text Document.txt New Folder/ New Folder/ 

Hope this is not impossible.

+1
source share
1 answer

use split('/',path) or preg_split (for php 6) the documentation (with examples) can be found here: http://www.php.net/manual/en/function.split.php and http: // www .php.net / manual / en / function.preg-split.php

0
source

All Articles