当前位置: 首页>>代码示例>>PHP>>正文


PHP dir_tree函数代码示例

本文整理汇总了PHP中dir_tree函数的典型用法代码示例。如果您正苦于以下问题:PHP dir_tree函数的具体用法?PHP dir_tree怎么用?PHP dir_tree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dir_tree函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load_recursive_include_path

function load_recursive_include_path($sPathDir, $arNotToCountOn = array(), $sDS = "/")
{
    //bug($arNotToCountOn);die;
    $arDirPaths = dir_tree($sPathDir, $arNotToCountOn, $sDS);
    $sDirPaths = implode(PATH_SEPARATOR, $arDirPaths);
    if (!empty($sDirPaths)) {
        $sDirPaths = get_include_path() . PATH_SEPARATOR . $sDirPaths;
        set_include_path($sDirPaths);
    }
}
开发者ID:eacevedof,项目名称:prj_anytest,代码行数:10,代码来源:dir_tree.php

示例2: ShowVertify

function ShowVertify()
{
    global $CONF, $LNG;
    $EXT = explode("|", HTTP::_GP("ext", ""));
    $action = HTTP::_GP("action", "");
    $file = HTTP::_GP("file", "");
    $template = new template();
    switch ($action) {
        case 'check':
            $REV = explode(".", Config::get("VERSION"));
            $REV = $REV[2];
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_AUTOREFERER, true);
            curl_setopt($ch, CURLOPT_URL, 'http://2moons.googlecode.com/svn-history/r' . $REV . '/trunk/' . $file);
            curl_setopt($ch, CURLOPT_HEADER, false);
            curl_setopt($ch, CURLOPT_USERAGENT, "2Moons Update API");
            curl_setopt($ch, CURLOPT_CRLF, true);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $FILE = curl_exec($ch);
            $SVNHASH = crc32(preg_replace(array("/(\r\n)|(\r)/", '/(\\/\\*[\\d\\D]*?\\*\\/)/', '/\\$I' . 'd[^\\$]+\\$/'), array("\n", '', ''), $FILE));
            if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == 404) {
                echo 4;
                exit;
            }
            if (curl_errno($ch)) {
                echo 3;
                exit;
            }
            curl_close($ch);
            $FILE2 = file_get_contents(ROOT_PATH . $file);
            $LOCALHASH = crc32(preg_replace(array("/(\r\n)|(\r)/", '/(\\/\\*[\\d\\D]*?\\*\\/)/', '/\\$I' . 'd[^\\$]+\\$/'), array("\n", '', ''), $FILE2));
            if ($SVNHASH == $LOCALHASH) {
                echo 1;
                exit;
            } else {
                echo 2;
                exit;
            }
            exit;
            break;
        case 'vertify':
            $template->loadscript('vertify.js');
            $template->show("VertifyPageResult.tpl");
            exit;
            break;
        case 'getFileList':
            echo json_encode(array_merge(dir_tree('./', $EXT, false), dir_tree('chat/', $EXT), dir_tree('includes/', $EXT), dir_tree('includes/', $EXT), dir_tree('language/', $EXT), dir_tree('scripts/', $EXT), dir_tree('styles/', $EXT)));
            exit;
            break;
    }
    $template->show("VertifyPage.tpl");
}
开发者ID:Decoder1978,项目名称:Xterium,代码行数:52,代码来源:ShowVertify.php

示例3: dir_tree

function dir_tree($dir, $root = null)
{
    foreach ($dir as $name => $sub) {
        $name = $root . $name;
        if (!file_exists($name)) {
            mkdir($name);
        }
        if (is_array($sub)) {
            dir_tree($sub, $name . '/');
        }
    }
    return true;
}
开发者ID:m1ke,项目名称:easy-site-utils,代码行数:13,代码来源:file.php

示例4: dir_tree

function dir_tree($directory, $level)
{
    //$num = "1";
    //echo ("<b>Soubory v $directory :</b><br /><br />\n<ul>");
    $dirfp = opendir($directory);
    $leveli = $level;
    while ($leveli) {
        echo "-";
        $leveli--;
    }
    echo "[DIR] {$directory}\n";
    while (false !== ($file = readdir($dirfp))) {
        if ($file != "." && $file != "..") {
            if (is_dir($directory . $file)) {
                echo "\n";
                $leveli = $level;
                while ($leveli < 0) {
                    echo "-";
                    $leveli--;
                }
                //echo "-[DIR] $file\n";
                dir_tree("{$directory}{$file}\\", $level + 2);
                echo "\n";
            } else {
                $leveli = $level;
                while ($leveli + 1) {
                    echo "-";
                    $leveli--;
                }
                echo "{$file} - ({$directory}{$file})\n";
                //$num = ($num + 1);
            }
        }
    }
    closedir($dirfp);
}
开发者ID:Harvie,项目名称:Programs,代码行数:36,代码来源:dir_tree.php

示例5: substr

                 $dbexists = true;
             } else {
                 $extension_not_allowed = true;
             }
         }
     }
 }
 //- Scan a directory for databases
 if ($directory !== false) {
     if ($directory[strlen($directory) - 1] == DIRECTORY_SEPARATOR) {
         //if user has a trailing slash in the directory, remove it
         $directory = substr($directory, 0, strlen($directory) - 1);
     }
     if (is_dir($directory)) {
         if ($subdirectories === true) {
             $arr = dir_tree($directory);
         } else {
             $arr = scandir($directory);
         }
         $databases = array();
         $j = 0;
         for ($i = 0; $i < sizeof($arr); $i++) {
             if ($subdirectories === false) {
                 $arr[$i] = $directory . DIRECTORY_SEPARATOR . $arr[$i];
             }
             if (@(!is_file($arr[$i]))) {
                 continue;
             }
             $con = file_get_contents($arr[$i], NULL, NULL, 0, 60);
             if (strpos($con, "** This file contains an SQLite 2.1 database **", 0) !== false || strpos($con, "SQLite format 3", 0) !== false) {
                 $databases[$j]['path'] = $arr[$i];
开发者ID:gorvelyfab,项目名称:pla,代码行数:31,代码来源:index.php

示例6: dir_tree

/**
 * Returns directory tree starting at given directory.
 *
 * @param string starting directory
 * @param integer maximum depth of the tree
 * @param integer depth counter, for internal use
 * @return array directory tree
 */
function dir_tree($path, $hidden = false, $maxdepth = -1, $d = 0)
{
    if (substr($path, strlen($path) - 1) != '/') {
        $path .= '/';
    }
    $hiddens = @file_get_contents($path . '.hidden');
    if ($hiddens) {
        $hiddens = explode(",", trim($hiddens));
    }
    if (is_array($hidden)) {
        if (!is_array($hiddens)) {
            $hiddens = array();
        }
        $hiddens = array_merge($hiddens, $hidden);
        $show_hidden = false;
    } elseif ($hidden) {
        $show_hidden = true;
    } else {
        $show_hidden = false;
    }
    $dirlist = array();
    $dirlist[] = $path;
    if ($handle = opendir($path)) {
        while (false !== ($file = readdir($handle))) {
            if ($file == '.' || $file == '..' || !$show_hidden && preg_match('/^\\./', $file) || $hiddens && in_array($file, $hiddens)) {
                continue;
            }
            $file = $path . $file;
            if (is_dir($file) && $d >= 0 && ($d < $maxdepth || $maxdepth < 0)) {
                $result = dir_tree($file . '/', $hidden, $maxdepth, $d + 1);
                $dirlist = array_merge($dirlist, $result);
            }
        }
        closedir($handle);
    }
    if ($d == 0) {
        natcasesort($dirlist);
    }
    return $dirlist;
}
开发者ID:62BRAINS,项目名称:EPESI,代码行数:48,代码来源:misc.php

示例7: comboAction

 /**
  * combo store数据
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2013-06-27 17:45:25
  *
  * @return void 无返回值
  */
 public function comboAction()
 {
     $dir_arr = dir_tree(LOG_PATH);
     foreach ($dir_arr as $k => $item) {
         $dir_arr[$k] = array('filename' => str_replace(LOG_PATH, '', $item['dir']));
     }
     array_unshift($dir_arr, array('filename' => DS));
     $this->_ajaxReturn(true, '', $dir_arr);
 }
开发者ID:yunsite,项目名称:yablog,代码行数:17,代码来源:Filelog.class.php

示例8: dir_tree

/**
 * 目录列表
 *
 * @param string $dir       路径
 * @param bool   $recursive 递归。默认true
 * @param int    $parent_id 父id。默认0
 * @param array  $dirs      传入的目录。默认array()
 *
 * @param array 目录列表
 */
function dir_tree($dir, $recursive = true, $parent_id = 0, $dirs = array())
{
    global $id;
    $parent_id == 0 && ($id = 0);
    $list = glob($dir . '*');
    foreach ($list as $v) {
        if (is_dir($v) && $recursive) {
            $id++;
            $dirs[$id] = array('id' => $id, 'parentid' => $parent_id, 'name' => basename($v), 'dir' => $v . '/');
            $dirs = dir_tree($v . '/', $recursive, $id, $dirs);
        }
    }
    return $dirs;
}
开发者ID:yunsite,项目名称:yablog,代码行数:24,代码来源:dir.php

示例9: dir_tree

 function dir_tree($df, $level = 0)
 {
     global $tcolors, $self;
     $df = str_replace("//", "/", $df);
     $dirs = array();
     $files = array();
     if ($dir = opendir($df)) {
         while (($file = readdir($dir)) !== false) {
             if ($file == "." || $file == "..") {
                 continue;
             }
             if (is_dir("{$df}/{$file}")) {
                 $dirs[] = $file;
             } else {
                 $files[] = $file;
             }
         }
     }
     closedir($dir);
     sort($dirs);
     sort($files);
     $i = min($level, count($tcolors) - 1);
     $c = $tcolors[$i][0] . $tcolors[$i][0] . $tcolors[$i][1] . $tcolors[$i][1] . $tcolors[$i][2] . $tcolors[$i][2];
     echo "\r\n\r\n\r\n\n   <table width=100% border=0 cellspacing=2 cellpadding=1><tr><td bgcolor=#000000>\n   <table width=100% border=0 cellspacing=0 cellpadding=1 bgcolor=#{$c}>\n   <tr><td colspan=3 class=dir>" . "<a href={$self}?c=l&d=" . urlencode($df) . " class=dir><img src={$self}?name=dir&c=img&1 border=0>" . $df . "</a></td></tr>";
     if (count($dirs) || count($files)) {
         echo "<tr><td width=15>&nbsp;</td><td class=all width=97%>";
         for ($i = 0; $i < count($files); $i++) {
             echo $files[$i] . " ";
         }
         for ($i = 0; $i < count($dirs); $i++) {
             dir_tree($df . "/" . $dirs[$i], $level + 1);
         }
         echo "</td><td width=10>&nbsp;</td></tr>";
     }
     echo '</table></td></tr></table>';
 }
开发者ID:ASDAFF,项目名称:Shells-Database,代码行数:36,代码来源:PHPRemoteView.php

示例10: list_modules

 /**
  * Creates list of modules currently available to install along with list of available versions.
  *
  * @return array array built as follows: array('Box'=>array(0,1)...)
  */
 public static final function list_modules()
 {
     $dirs = dir_tree('modules', array('theme', 'lang', 'help'));
     $ret = array();
     foreach ($dirs as $d) {
         $module = str_replace('/', '_', substr($d, 8, -1));
         $file = self::get_module_file_name($module);
         if (!file_exists($d . $file . 'Install.php')) {
             continue;
         }
         self::include_install($module);
         $version_f = array(self::$modules_install[$module], 'version');
         if (is_callable($version_f)) {
             $version_ret = call_user_func($version_f);
         } else {
             $version_ret = 0;
         }
         $version_arr = array();
         if (is_array($version_ret)) {
             $version_arr = $version_ret;
             $version = count($version_ret);
         } else {
             $version = intval($version_ret);
             for ($i = 0; $i <= $version; $i++) {
                 $version_arr[] = $i;
             }
         }
         $ret[$module] = $version_arr;
     }
     return $ret;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:36,代码来源:module_manager.php

示例11: dir_tree

function dir_tree($dir, $parentid = 0, $dirs = array())
{
    if ($parentid == 0) {
        $id = 0;
    }
    $list = glob($dir . '*');
    foreach ($list as $v) {
        if (is_dir($v)) {
            $id++;
            $dirs[$id] = array('id' => $id, 'parentid' => $parentid, 'name' => basename($v), 'dir' => $v . '/');
            $dirs = dir_tree($v . '/', $id, $dirs);
        }
    }
    return $dirs;
}
开发者ID:JavaAFei,项目名称:yun001,代码行数:15,代码来源:~runtime.php

示例12: array

if ($numeric_alt_suffixes > 0) {
    // add numeric suffixes to alt suffix list if we've been told to do that.
    $newsuffixarray = array();
    foreach ($staticsync_alt_suffix_array as $thesuffix) {
        array_push($newsuffixarray, $thesuffix);
        for ($i = 1; $i < $numeric_alt_suffixes; $i++) {
            array_push($newsuffixarray, $thesuffix . $i);
        }
    }
    $staticsync_alt_suffix_array = $newsuffixarray;
}
echo date('Y-m-d H:i:s    ');
echo "Looking for orphaned alternate files\n";
echo date('Y-m-d H:i:s    ');
echo "syncdir is {$syncdir}\n";
$files = dir_tree($syncdir);
//print_r($staticsync_alt_suffix_array);
foreach ($files as $thefile) {
    if (is_dir($thefile) || preg_match("/^\\..*/", basename($thefile))) {
        continue;
    }
    // ignore directories and hidden files
    //echo "$thefile\n";
    foreach ($staticsync_alt_suffix_array as $suffix) {
        if (preg_match("/^" . preg_quote($syncdir, "/") . "\\/(.*)\\/([^\\/]+)({$suffix})\\.([^.]+)\$/", $thefile, $matches)) {
            echo date('Y-m-d H:i:s    ');
            echo "Processing {$thefile}\n";
            //print_r($matches);
            $filename_field = 51;
            $searchpath = addslashes(str_replace('/', '~', $matches[1]));
            $filename = $matches['2'];
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:31,代码来源:ss_alt_makeup.php

示例13: init_tables

function init_tables()
{
    create_tables();
    dir_tree();
}
开发者ID:undisputed-seraphim,项目名称:manga_server,代码行数:5,代码来源:sqlite.php


注:本文中的dir_tree函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。