| Revision 8758,
1.1 KB
checked in by uehara, 20 years ago
(diff) |
|
blank
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | $arrTree = array(); |
|---|
| 4 | $cnt = 0; |
|---|
| 5 | print_r(sfGetFileTree("/home/web/test.ec-cube.net/html/user_data/")); |
|---|
| 6 | /* |
|---|
| 7 | function sfGetFileTree($dir) { |
|---|
| 8 | global $arrTree; |
|---|
| 9 | |
|---|
| 10 | if(file_exists($dir)) { |
|---|
| 11 | if ($handle = opendir("$dir")) { |
|---|
| 12 | while (false !== ($item = readdir($handle))) { |
|---|
| 13 | if ($item != "." && $item != "..") { |
|---|
| 14 | if (is_dir("$dir/$item")) { |
|---|
| 15 | $arrResult[$cnt]['file_name'] = "$dir/$item"; |
|---|
| 16 | $cnt++; |
|---|
| 17 | sfGetFileTree("$dir/$item"); |
|---|
| 18 | } |
|---|
| 19 | } |
|---|
| 20 | $cnt++; |
|---|
| 21 | } |
|---|
| 22 | } |
|---|
| 23 | closedir($handle); |
|---|
| 24 | //$arrResult[$cnt]['file_name'] = "$dir/$item"; |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | return $arrResult; |
|---|
| 28 | } |
|---|
| 29 | */ |
|---|
| 30 | |
|---|
| 31 | function sfGetFileTree($dir) { |
|---|
| 32 | global $arrTree; |
|---|
| 33 | if(file_exists($dir)) { |
|---|
| 34 | // ¥Ç¥£¥ì¥¯¥È¥ê¤«¥Á¥§¥Ã¥¯ |
|---|
| 35 | if (is_dir($dir)) { |
|---|
| 36 | if ($handle = opendir("$dir")) { |
|---|
| 37 | $cnt = 0; |
|---|
| 38 | while (false !== ($item = readdir($handle))) { |
|---|
| 39 | if ($item != "." && $item != "..") { |
|---|
| 40 | if (is_dir("$dir/$item")) { |
|---|
| 41 | echo $arrTree[$cnt]['file_name'] = "$dir/$item<br/>"; |
|---|
| 42 | sfGetFileTree("$dir/$item"); |
|---|
| 43 | } |
|---|
| 44 | } |
|---|
| 45 | $cnt++; |
|---|
| 46 | } |
|---|
| 47 | } |
|---|
| 48 | closedir($handle); |
|---|
| 49 | //echo $arrResult[$cnt]['file_name'] = "$dir/$item<br/>"; |
|---|
| 50 | } |
|---|
| 51 | } |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | ?> |
|---|
Note: See
TracBrowser
for help on using the repository browser.