| Revision 8760,
1.0 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 | sfGetFileTree("/home/web/test.ec-cube.net/html/user_data/"); |
|---|
| 6 | print_r($arrTree); |
|---|
| 7 | /* |
|---|
| 8 | function sfGetFileTree($dir) { |
|---|
| 9 | global $arrTree; |
|---|
| 10 | |
|---|
| 11 | if(file_exists($dir)) { |
|---|
| 12 | if ($handle = opendir("$dir")) { |
|---|
| 13 | while (false !== ($item = readdir($handle))) { |
|---|
| 14 | if ($item != "." && $item != "..") { |
|---|
| 15 | if (is_dir("$dir/$item")) { |
|---|
| 16 | $arrResult[$cnt]['file_name'] = "$dir/$item"; |
|---|
| 17 | $cnt++; |
|---|
| 18 | sfGetFileTree("$dir/$item"); |
|---|
| 19 | } |
|---|
| 20 | } |
|---|
| 21 | $cnt++; |
|---|
| 22 | } |
|---|
| 23 | } |
|---|
| 24 | closedir($handle); |
|---|
| 25 | //$arrResult[$cnt]['file_name'] = "$dir/$item"; |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | return $arrResult; |
|---|
| 29 | } |
|---|
| 30 | */ |
|---|
| 31 | |
|---|
| 32 | function sfGetFileTree($dir) { |
|---|
| 33 | global $arrTree; |
|---|
| 34 | if(file_exists($dir)) { |
|---|
| 35 | // ¥Ç¥£¥ì¥¯¥È¥ê¤«¥Á¥§¥Ã¥¯ |
|---|
| 36 | if (is_dir($dir)) { |
|---|
| 37 | if ($handle = opendir("$dir")) { |
|---|
| 38 | $cnt = 0; |
|---|
| 39 | while (false !== ($item = readdir($handle))) { |
|---|
| 40 | if ($item != "." && $item != "..") { |
|---|
| 41 | if (is_dir("$dir/$item")) { |
|---|
| 42 | $arrTree[]['file_name'] = "$dir/$item<br/>"; |
|---|
| 43 | sfGetFileTree("$dir/$item"); |
|---|
| 44 | } |
|---|
| 45 | } |
|---|
| 46 | $cnt++; |
|---|
| 47 | } |
|---|
| 48 | } |
|---|
| 49 | closedir($handle); |
|---|
| 50 | } |
|---|
| 51 | } |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | ?> |
|---|
Note: See
TracBrowser
for help on using the repository browser.