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

Revision 8763, 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;
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                    $dir = ereg_replace("/$", "", $dir);
41                    // ¥Ç¥£¥ì¥¯¥È¥ê¤Î¤ß¼èÆÀ
42                    if (is_dir("$dir/$item")) {
43                        $arrTree[]['file_name'] = "$dir/$item";
44                        // ²¼Áإǥ£¥ì¥¯¥È¥ê¼èÆÀ¤Î°Ù¡¢ºÆµ¢Åª¤Ë¸Æ¤Ó½Ð¤¹
45                        sfGetFileTree("$dir/$item");
46                    }
47                }
48                $cnt++;
49            }
50        }
51        closedir($handle);
52    }
53}
54
55
56?>
Note: See TracBrowser for help on using the repository browser.