简体   繁体   中英

Php recursive directory listing flow

I have various projects going on that I need to document and then display pictorial progress on. It is set up as project\year\month\pic.jpg... I was planning on having in the root of the section a index.php that would list the directorys and create a link that when clicked would pass the project\ directory to a listing.php page. With the listing php it would read the contents of project\ the files in that directory would make the initial page content. The listing.php would then read the \project\year\month\ directorys in order. at the bottom of the listing.php page would be an href=year\month. if one of the links to the year-month is clicked it would open another page that would view the pictures in abc-123 order. it would have a dropdown for selecting other year/month's and a next/previous button.

I get the readdir / scandir part and can list a single dir eaisly enough. I have no idea how to make the callback work for that or if/how to make dynamic global arrays to store the info in. memory comsumption isnt to troubling for me as the directorys are 2-3 deep only a couple projects have 40k or so images. the average looks to be 3k or less photos

If php is a bad way of doing this then what would be a good way so that the listing.php type page is always current and the display pages so I dont have to worry about having it updated via script every so often.

You'll want to use iterators, probably - see this question and it's answer: PHP recursive directory path

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM