File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ require __DIR__ . '/../tests/bootstrap.php ' ;
3+
4+ use Upyun \Config ;
5+ use Upyun \Upyun ;
6+
7+ $ config = new Config (BUCKET , USER_NAME , PWD );
8+ $ upyun = new Upyun ($ config );
9+
10+ $ start = null ;
11+ $ total = 0 ;
12+ do {
13+ $ list = $ upyun ->read ('/ ' , null , array (
14+ 'X-List-Limit ' => 100 ,
15+ 'X-List-Iter ' => $ start ,
16+ ));
17+
18+ if (is_array ($ list ['files ' ])) {
19+ foreach ($ list ['files ' ] as $ file ) {
20+ $ total ++;
21+ if ($ file ['type ' ] === 'N ' ) {
22+ echo '文件名: ' ;
23+ } else {
24+ echo '目录名: ' ;
25+ }
26+ echo $ file ['name ' ];
27+ echo ' 大小: ' . $ file ['size ' ];
28+ echo ' 修改时间: ' . date ('Y-m-d H:i:s ' , $ file ['time ' ]);
29+ echo "\n" ;
30+ }
31+
32+ }
33+ $ start = $ list ['iter ' ];
34+ } while (!$ list ['is_end ' ]);
35+
36+ echo '总共存有文件 ' . $ total . ' 个 ' ;
You can’t perform that action at this time.
0 commit comments