I'm having a directory with this structure :
- main/
- |- images/
- |-- file1.jpg
- |-- file2.jpg
- |-- file3.jpg
- |- documents/
- |-- private/
- |-- test.doc
- |-- test.xls
- |-- test.txt
I can create a function to complete the work but the RecursiveDirectoryIterator class is much faster and less memory usage this time. How can I use RecursiveDirectoryIterator to list these directory into an array like this :
array(
"main/" => array(
"images/" => array(
"file1.jpg",
"file2.jpg",
"file3.jpg"
),
"documents/" => array(
"private/" => array(
"blahblahblah.docx"
),
"test.doc",
"test.xls",
"test.txt"
)
)
)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…