【发布时间】:2010-12-24 18:34:17
【问题描述】:
使用 PHP,我得到了以下文件列表:
new ZipArchive();
我的意思是它在一个 zip 文件中。
文件列表为:
- 文档/
- docs/INSTALL.html
- docs/auth_api.html
- docs/corners_right.gif
- docs/corners_right.png
- 文档/复制
- 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/README.html
- docs/corners_left.gif
- docs/stylesheet.css
- docs/新建文件夹/
- docs/New Folder/New Text Document.txt
- docs/新建文件夹/新建文件夹/
我需要一种方法从每个文件路径中删除目录名称并使其成为子类别。
所以输出应该是这样的:
docs/
INSTALL.html
auth_api.html
corners_right.gif
corners_right.png
COPYING
New Folder/
New Text Document.txt
New Folder/
New Folder/
我希望这不是不可能的
【问题讨论】:
-
只是为了在文件系统中显示或进一步处理?
-
因为我希望任何人解决它
-
stackoverflow.com/a/11548872/110488 有一个针对类似问题的通用解决方案,可能会给您一些见解。
标签: php tree text-processing