|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 |
<?php$folderPath
= "C:/wamp";printDir($folderPath, 0);function
printDir($rootPath, $deep){ echo
$rootPath."<br>"; $folderArr
= scandir($rootPath); foreach
($folderArr
as $path) { $currPath
= $rootPath."/".$path; if
($path != "." && $path
!= "..") { if
(is_dir($currPath)) printDir($currPath, $deep
+ 1); else printItem($path, $deep
+ 1); } }}function
printItem($path, $deep){ echo
"|"; for
($i = 0; $i < $deep
- 1; $i++) { echo
" |"; } echo
"----".$path."<br>";}?> |
原文:http://www.cnblogs.com/jsncz/p/3663801.html