source: temp/trunk/html/test/uehara/test.php @ 8761

Revision 8761, 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;
5sfGetFileTree("/home/web/test.ec-cube.net/html/user_data/");
6print_r($arrTree);
7/*
8function 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
32function sfGetFileTree($dir) {
33    global $arrTree;
34    if(file_exists($dir)) {
35        if ($handle = opendir("$dir")) {
36            $cnt = 0;
37            while (false !== ($item = readdir($handle))) {
38                if ($item != "." && $item != "..") {
39                    // ¥Ç¥£¥ì¥¯¥È¥ê¤«¥Á¥§¥Ã¥¯
40                    if (is_dir("$dir/$item")) {
41                        $arrTree[]['file_name'] = "$dir/$item<br/>";
42                        // ²¼Áإǥ£¥ì¥¯¥È¥ê¼èÆÀ¤Î°Ù¡¢ºÆµ¢Åª¤Ë¸Æ¤Ó½Ð¤¹
43                        sfGetFileTree("$dir/$item");
44                    }
45                }
46                $cnt++;
47            }
48        }
49        closedir($handle);
50    }
51}
52
53
54?>
Note: See TracBrowser for help on using the repository browser.