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


PHP listDir函数代码示例

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


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

示例1: listDir

function listDir($dir)
{
    global $words;
    if (is_dir($dir)) {
        if ($handle = opendir($dir)) {
            while ($file = readdir($handle)) {
                if ($file != '.' && $file != '..') {
                    if (is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
                        listDir($dir . DIRECTORY_SEPARATOR . $file);
                    } else {
                        //$r = file_get_contents($dir.DIRECTORY_SEPARATOR.$file);
                        //$words += (str_word_count(showtextintags($r)));
                        $fl = fopen($dir . DIRECTORY_SEPARATOR . $file, 'r');
                        $i = 0;
                        while (!feof($fl)) {
                            fgets($fl);
                            $i++;
                        }
                        fclose($fl);
                        $words += $i - 72;
                    }
                }
            }
        }
        closedir($handle);
    } else {
        echo 'Fetal folder!';
    }
}
开发者ID:reage,项目名称:flightigem,代码行数:29,代码来源:countword.php

示例2: runJavaTests

function runJavaTests($clientRoot)
{
    global $config;
    $jdkPath = $config['java']['jdk_path'];
    $externalJars = listDir("{$clientRoot}/lib");
    if (!is_dir("{$clientRoot}/bin")) {
        mkdir("{$clientRoot}/bin");
    }
    chdir("{$clientRoot}/bin");
    // compile the client library
    executeCommand("{$jdkPath}javac.exe", "-d . -sourcepath ../src -cp " . implode(';', addPrefix($externalJars, '../lib/')) . " ../src/com/kaltura/client/test/KalturaTestSuite.java");
    // pack the client library
    executeCommand("{$jdkPath}jar.exe", "cvf kalturaClient.jar .");
    // run the tests
    copy("{$clientRoot}/src/DemoImage.jpg", "{$clientRoot}/bin/DemoImage.jpg");
    copy("{$clientRoot}/src/DemoVideo.flv", "{$clientRoot}/bin/DemoVideo.flv");
    copy("{$clientRoot}/src/test.properties", "{$clientRoot}/bin/test.properties");
    $log4jConfig = fixSlashes("{$clientRoot}/src/log4j/log4j.properties");
    if ($log4jConfig[1] == ':') {
        $log4jConfig = substr($log4jConfig, 2);
    }
    $log4jParam = "-Dlog4j.configuration=file://{$log4jConfig}";
    $jarList = "bin/kalturaClient.jar;" . implode(';', addPrefix($externalJars, 'lib/'));
    chdir($clientRoot);
    executeCommand("{$jdkPath}java.exe", "-cp {$jarList} {$log4jParam} org.junit.runner.JUnitCore com.kaltura.client.test.KalturaTestSuite");
}
开发者ID:DBezemer,项目名称:server,代码行数:26,代码来源:4_runTests.php

示例3: listDir

function listDir($dir){
   if(is_dir($dir)){
     if ($dh = opendir($dir)) {
        while (($file= readdir($dh)) !== false){
		
       if((is_dir($dir."/".$file)) && $file!="." && $file!="..")
       {
	    if(is_writable($dir."/".$file)&&is_readable($dir."/".$file))
		{
		echo "<b><font color='red'>文件名:</font></b>".$dir.$file."<font color='red'> 可写</font><font color='Blue'> 可读</font>"."<br><hr>";
		}else{
		if(is_writable($dir."/".$file))
		{
              echo "<b><font color='red'>文件名:</font></b>".$dir.$file."<font color='red'> 可写</font>"."<br><hr>";
		}else
		{
	      echo "<b><font color='red'>文件名:</font></b>".$dir.$file."<font color='red'> 可读</font><font color='Blue'> 不可写</font>"."<br><hr>";
		}
		}
		
		listDir($dir."/".$file."/");
       }
     
       }
        }
closedir($dh);

     }
 
   }
开发者ID:xl7dev,项目名称:WebShell,代码行数:30,代码来源:仗剑孤行搜索可读可写目录脚本.php

示例4: listDir

/**
 * @param $dir
 */
function listDir($dir)
{
    echo $dir . PHP_EOL;
    if (is_dir($dir)) {
        $sub_dirs = scandir($dir);
        foreach ($sub_dirs as $sub_dir) {
            if ($sub_dir == '.' || $sub_dir == '..') {
                continue;
            }
            listDir($dir . DIRECTORY_SEPARATOR . $sub_dir);
        }
    }
}
开发者ID:amlun,项目名称:phptools,代码行数:16,代码来源:listDir.php

示例5: listDir

function listDir($dir)
{
    $dir .= substr($dir, -1) == D_S ? '' : D_S;
    $dirInfo = array();
    foreach (glob($dir . '*') as $v) {
        if (is_dir($v)) {
            $dirInfo = array_merge($dirInfo, listDir($v));
        } else {
            $dirInfo[] = $v;
        }
    }
    return $dirInfo;
}
开发者ID:iloster,项目名称:rumor-php,代码行数:13,代码来源:listAllApis.php

示例6: parse

 public function parse()
 {
     $list = split(' ', $expression);
     foreach ($list as $value) {
         if ($value[0] == '~') {
             $exclude[] = substr($value, 1, strlen($value)) . '.php';
         } else {
             if ($value[0] == '*') {
                 $include[] = listDir($this->path);
             }
         }
     }
 }
开发者ID:reZo,项目名称:Tiger,代码行数:13,代码来源:load.php

示例7: listPath

function listPath($path)
{
    global $config;
    $path = fixPath($path);
    $path = rtrim($path, '/');
    if (accessLevel($path) < 1) {
        return array('type' => 'nope', 'path' => $path);
    }
    if (is_dir($config['files'] . $path)) {
        return listDir($path);
    }
    if (is_file($config['files'] . $path)) {
        return listFile($path);
    }
    return list404();
}
开发者ID:Dirbaio,项目名称:TurboFile,代码行数:16,代码来源:list.php

示例8: listDir

function listDir($root, $path, $phar)
{
    //print 'Entering ' . $root . $path . PHP_EOL;
    $it = new DirectoryIterator($root . $path);
    foreach ($it as $fileinfo) {
        $filename = $fileinfo->getFilename();
        if ($fileinfo->isDot() || stristr($filename, 'Test.php') || stristr($filename, '.git') || stristr($filename, '.gitignore') || stristr($filename, 'manual_tests') || stristr($filename, 'tests') || stristr($filename, 'Call-Logs') || stristr($filename, 'Json') || stristr($filename, 'Csv') || stristr($filename, 'Recordings') || stristr($filename, '_cache') || stristr($filename, 'dist') || stristr($filename, 'build') || stristr($filename, 'docs')) {
            continue;
        } elseif ($fileinfo->isDir()) {
            listDir($root, $path . '/' . $filename, $phar);
        } else {
            $key = ($path ? $path . '/' : '') . $filename;
            $phar[$key] = file_get_contents($root . $path . '/' . $fileinfo->getFilename());
            //print '  ' . $key . ' -> ' . $path . '/' . $filename . PHP_EOL;
        }
    }
}
开发者ID:anilkumarbp,项目名称:Sample-Demo-to-Download-Call-Recordings,代码行数:17,代码来源:create-phar.php

示例9: listDir

function listDir($path, $phar)
{
    $relPath = str_replace('/lib', '', $path);
    $it = new DirectoryIterator(__DIR__ . $path);
    foreach ($it as $fileinfo) {
        $filename = $fileinfo->getFilename();
        if ($fileinfo->isDot() || stristr($filename, 'Test.php')) {
            continue;
        } elseif ($fileinfo->isDir()) {
            listDir($path . '/' . $filename, $phar);
        } else {
            $key = ($relPath ? $relPath . '/' : '') . $filename;
            $phar[$key] = file_get_contents(__DIR__ . $path . '/' . $fileinfo->getFilename());
            //print $key . ' -> ' . $path . '/' . $filename . PHP_EOL;
        }
    }
}
开发者ID:vyshakhbabji,项目名称:ringcentral-php,代码行数:17,代码来源:create-phar.php

示例10: listDir

/**
 * 遍历一个文件夹下的所有文件和子文件夹
 */
function listDir($dir = '.')
{
    if ($handle = opendir($dir)) {
        while (false !== ($file = readdir($handle))) {
            if ($file == '.' || $file == '..') {
                continue;
            }
            if (is_dir($sub_dir = realpath($dir . '/' . $file))) {
                echo 'FILE in PATH:' . $dir . ':' . $file . '<br>';
                listDir($sub_dir);
            } else {
                echo 'FILE:' . $file . '<br>';
            }
        }
        closedir($handle);
    }
}
开发者ID:zncode,项目名称:codebase,代码行数:20,代码来源:list_dir.php

示例11: listDir

function listDir($dir)
{
    if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
            while (($file = readdir($dh)) !== false) {
                if (is_dir($dir . "/" . $file) && $file != "." && $file != "..") {
                    echo "<b><font color='red'>文件名:</font></b>", $file, "<br><hr>";
                    listDir($dir . "/" . $file . "/");
                } else {
                    if ($file != "." && $file != "..") {
                        echo $file . "<br>";
                    }
                }
            }
            closedir($dh);
        }
    }
}
开发者ID:lyhiving,项目名称:icampus,代码行数:18,代码来源:filelist.php

示例12: replaceInFolder

function replaceInFolder($path, $includeSuffixes, $excludeSuffixes, $search, $replace, $fileNameSearch = null, $fileNameReplace = null)
{
    $fileList = listDir($path);
    foreach ($fileList as $curFile) {
        $curPath = "{$path}/{$curFile}";
        if (is_dir($curPath)) {
            replaceInFolder($curPath, $includeSuffixes, $excludeSuffixes, $search, $replace, $fileNameSearch, $fileNameReplace);
        } else {
            if ($includeSuffixes && !endsWith($curPath, $includeSuffixes)) {
                continue;
            }
            if ($excludeSuffixes && endsWith($curPath, $excludeSuffixes)) {
                continue;
            }
            replaceInFile($curPath, $search, $replace, $fileNameSearch, $fileNameReplace);
        }
    }
}
开发者ID:DBezemer,项目名称:server,代码行数:18,代码来源:utils.php

示例13: listDir

function listDir($dir, $level, $arr, $arr_ass)
{
    if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
            while ($file = readdir($dh)) {
                if (is_dir($dir . "/" . $file) && $file != "." && $file != "..") {
                    listDir($dir . "/" . $file, $level, $arr, $arr_ass);
                } elseif ((string) $file[strlen($file) - 1] == "p" && (string) $file[strlen($file) - 2] == "h" && $file != "ws_finder.php") {
                    $result = checkFile($dir . "/" . $file, $level, $arr, $arr_ass);
                    if ($result != "safe") {
                        echo "<h2>发现威胁</h2>";
                        echo "<br/>" . "<code>" . $dir . "/" . $file . "可能是" . $result . "<br/></code><hr/>";
                    }
                } else {
                    continue;
                }
            }
        }
    }
}
开发者ID:shiham101,项目名称:webshell_finder-1,代码行数:20,代码来源:ws_finder.php

示例14: listDir

function listDir($dir)
{
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            if ($file != '.' && $file != '..') {
                if (filetype($dir . $file) == 'dir') {
                    echo '<br><b data-url="' . $dir . $file . '"> #' . $file . '</b> <a class="new-file">Novo arquivo</a><br>';
                    echo '<div class="sub">';
                    listDir($dir . $file . '/');
                    echo '</div>';
                } else {
                    if (filetype($dir . $file) == 'file') {
                        echo '<span class="file" data-url="' . $dir . $file . '">' . $file . '</span><a class="file-link link-rename">Renomear</a><a class="file-link link-delete">Excluir</a><br>';
                    } else {
                        echo '<br>error<br>';
                    }
                }
            }
        }
        closedir($dh);
    }
}
开发者ID:ezanattatray,项目名称:Editor4OC,代码行数:22,代码来源:index.php

示例15: listDir

function listDir($dir, $level, $array)
{
    if ($level <= 0) {
        return;
    }
    if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
            while (($file = readdir($dh)) !== false) {
                $_array = array();
                if ($file != "." && $file != "..") {
                    if (is_dir($dir . "/" . $file)) {
                        $_array = array_fill(0, 1, $file);
                        $_array = listDir($dir . "/" . $file . "/", $level - 1, $_array);
                    } else {
                        array_push($_array, $file);
                    }
                    array_push($array, $_array);
                }
            }
            closedir($dh);
        }
    }
    return $array;
}
开发者ID:qioixiy,项目名称:bishe,代码行数:24,代码来源:list.php


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