• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP listDir函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: get_unasigned_disks

function get_unasigned_disks() {
  $disks = array();
  $paths = listDir("/dev/disk/by-id");
  natsort($paths);
  $unraid_flash = realpath("/dev/disk/by-label/UNRAID");
  $unraid_disks = array();
  foreach (parse_ini_string(shell_exec("/root/mdcmd status 2>/dev/null")) as $k => $v) {
    if (strpos($k, "rdevName") !== FALSE && strlen($v)) {
      $unraid_disks[] = realpath("/dev/$v");
    }
  }
  // foreach ($unraid_disks as $k) {$o .= "  $k\n";}; debug("UNRAID DISKS:\n$o");
  $unraid_cache = array();
  foreach (parse_ini_file("/boot/config/disk.cfg") as $k => $v) {
    if (strpos($k, "cacheId") !== FALSE && strlen($v)) {
      foreach ( preg_grep("#".$v."$#i", $paths) as $c) $unraid_cache[] = realpath($c);
    }
  }
  // foreach ($unraid_cache as $k) {$g .= "  $k\n";}; debug("UNRAID CACHE:\n$g");
  foreach ($paths as $d) {
    $path = realpath($d);
    if (preg_match("#^(.(?!wwn|part))*$#", $d)) {
      if (! in_array($path, $unraid_disks) && ! in_array($path, $unraid_cache) && strpos($unraid_flash, $path) === FALSE) {
        if (in_array($path, array_map(function($ar){return $ar['device'];},$disks)) ) continue;
        $m = array_values(preg_grep("#$d.*-part\d+#", $paths));
        natsort($m);
        $disks[$d] = array("device"=>$path,"type"=>"ata","partitions"=>$m);
        // debug("Unassigned disk: $d");
      } else {
        // debug("Discarded: => $d ($path)");
        continue;
      }
    } 
  }
  return $disks;
}
开发者ID:roninkenji,项目名称:unRAID-plugins,代码行数:36,代码来源:Preclear.php


示例17: str_replace

Action: resetservices
Action: readconfig;
';
    } else {
        $myreplacemenu .= '[switchApache' . $oneApacheVersion . ']
Action: run; FileName: "' . $c_phpExe . '";Parameters: "msg.php 2";WorkingDir: "' . $c_installDir . '/scripts"; Flags: waituntilterminated
';
    }
}
$myreplace .= 'Type: separator;
Type: item; Caption: "Get more..."; Action: run; FileName: "' . $c_navigator . '"; Parameters: "http://www.wampserver.com/addons_apache.php";
';
$tpl = str_replace($myPattern, $myreplace . $myreplacemenu, $tpl);
// ************************
// versions de MySQL
$mysqlVersionList = listDir($c_mysqlVersionDir, 'checkMysqlConf');
$myPattern = ';WAMPMYSQLVERSIONSTART';
$myreplace = $myPattern . "\n";
$myreplacemenu = '';
foreach ($mysqlVersionList as $oneMysql) {
    $oneMysqlVersion = str_ireplace('mysql', '', $oneMysql);
    if (isset($mysqlConf)) {
        $mysqlConf = NULL;
    }
    include $c_mysqlVersionDir . '/mysql' . $oneMysqlVersion . '/' . $wampBinConfFiles;
    if ($oneMysqlVersion === $wampConf['mysqlVersion']) {
        $myreplace .= 'Type: item; Caption: "' . $oneMysqlVersion . '"; Action: multi; Actions:switchMysql' . $oneMysqlVersion . '; Glyph: 13
';
    } else {
        $myreplace .= 'Type: item; Caption: "' . $oneMysqlVersion . '"; Action: multi; Actions:switchMysql' . $oneMysqlVersion . '
';
开发者ID:lcylp,项目名称:wamp,代码行数:31,代码来源:refresh.php


示例18: elseif

    } elseif ($mysqlServer[$oneMysqlVersion] == -1) {
        $myreplace .= 'Type: item; Caption: "' . $oneMysqlVersion . '"; Action: multi; Actions:switchMysql' . $oneMysqlVersion . '; Glyph: 19
';
        $myreplacemenu .= '[switchMysql' . $oneMysqlVersion . ']
Action: run; FileName: "' . $c_phpExe . '";Parameters: "msg.php 13 ' . base64_encode($myIniFile) . ' ' . base64_encode($c_mysqlService) . '";WorkingDir: "' . $c_installDir . '/scripts"; Flags: waituntilterminated
';
    }
}
/*$myreplace .= 'Type: separator;
Type: item; Caption: "Get more..."; Action: run; FileName: "'.$c_navigator.'"; Parameters: "http://www.wampserver.com/addons_mysql.php";
';
*/
$tpl = str_replace($myPattern, $myreplace . $myreplacemenu, $tpl);
// ************************
// versions de MariaDB
$mariadbVersionList = listDir($c_mariadbVersionDir, 'checkMariadbConf');
$myPattern = ';WAMPMARIADBVERSIONSTART';
$myreplace = $myPattern . "\n";
$myreplacemenu = '';
foreach ($mariadbVersionList as $oneMariadb) {
    $oneMariadbVersion = str_ireplace('mariadb', '', $oneMariadb);
    unset($mariadbConf);
    include $c_mariadbVersionDir . '/mariadb' . $oneMariadbVersion . '/' . $wampBinConfFiles;
    //[modif oto] - Check name of the group [wamp...] under '# The MariaDB server' in my.ini file
    //    must be the name of the mariadb service.
    $myIniFile = $c_mariadbVersionDir . '/mariadb' . $oneMariadbVersion . '/' . $mariadbConf['mariadbConfFile'];
    $myIniContents = file_get_contents($myIniFile);
    if (strpos($myIniContents, "[" . $c_mariadbService . "]") === false) {
        $myIniContents = preg_replace("/^\\[wamp.*\\]\$/m", "[" . $c_mariadbService . "]", $myIniContents, 1, $count);
        if (!is_null($myIniContents) && $count == 1) {
            $fp = fopen($myIniFile, 'w');
开发者ID:f1-djerba,项目名称:wamp-conf,代码行数:31,代码来源:refresh.php


示例19: listDir

</HEAD>

<BODY>

<div id="header">
<?php 
include "header.php";
?>
</div>

<!-- Content goes here -->
<div id="index_content">
<?php 
include_once "markdown.php";
include_once "crawler.php";
$lala = listDir();
echo $lala;
//$my_text = arquivoo
//$my_html = Markdown($my_text);
//echo $my_html;
?>

</div>
<!-- Content ends here -->

<div id="footer">
<?php 
include "footer.php";
?>
</div>
开发者ID:robas,项目名称:robas.com.br,代码行数:30,代码来源:index.php


示例20: 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 (date("Y-m-d", filemtime($dir . "/" . $file)) > "2016-01-12") {
                        echo "<b><font color='red'>文件名:</font></b>", $dir, "/", $file, "更新时间", date("Y-m-d", filemtime($dir . "/" . $file)), "<br><hr><br>\n\r";
                    }
                    listDir($dir . "/" . $file . "/");
                } else {
                    if ($file != "." && $file != "..") {
                        if (date("Y-m-d", filemtime($dir . "/" . $file)) > "2016-01-12") {
                            echo $dir, "/", $file . "更新时间", date("Y-m-d", filemtime($dir . "/" . $file)), "<br>\n\r";
                        }
                    }
                }
            }
            closedir($dh);
        }
    }
}
开发者ID:winiceo,项目名称:job,代码行数:22,代码来源:leven.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP listEntities函数代码示例发布时间:2022-05-15
下一篇:
PHP listData函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap