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

PHP getFileList函数代码示例

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

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



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

示例1: getFileList

function getFileList($path)
{
    global $list;
    global $i;
    $directory = dir($path);
    while ($entry = $directory->read()) {
        if ($entry != "." && $entry != "..") {
            if (Is_Dir($path . "/" . $entry) && !eregi("__zbSessionTMP", $path . "/" . $entry)) {
                getFileList($path . "/" . $entry);
            } else {
                if (!eregi("now_connect.php", $path . "/" . $entry) && !eregi("now_member_connect.php", $path . "/" . $entry) && !eregi("__zbSessionTMP", $path . "/" . $entry)) {
                    $list[] = str_replace("../", "", $path . "/" . $entry);
                    echo ".";
                    $i++;
                    if ($i > 100) {
                        $i = 0;
                        echo "\n\t\t";
                    }
                }
                flush();
            }
        }
    }
    $directory->close();
}
开发者ID:minyounglee85,项目名称:Personal-Website,代码行数:25,代码来源:arrangefile2.php


示例2: getFileList

/**
 * Return array of filenames to convert
 * @param string $dirName
 * @return mixed
 */
function getFileList($dirName = null)
{
    if (!is_string($dirName)) {
        return false;
    }
    if (!is_dir($dirName)) {
        return false;
    }
    if (!is_readable($dirName)) {
        return false;
    }
    clearstatcache();
    $ret_ar = array();
    if (!($dh = opendir($dirName))) {
        return false;
    }
    while (false !== ($file = readdir($dh))) {
        if ($file == '..' or $file == '.') {
            continue;
        }
        $cur_file = $dirName . '/' . $file;
        if (is_dir($cur_file)) {
            $tmp_ar = getFileList($cur_file);
            if (is_array($tmp_ar)) {
                $ret_ar = array_merge($ret_ar, $tmp_ar);
            }
        }
        $ret_ar[] = $cur_file;
    }
    closedir($dh);
    natcasesort($ret_ar);
    return $ret_ar;
}
开发者ID:bizonix,项目名称:phpMyCA,代码行数:38,代码来源:der-to-pem.php


示例3: getFileList

/**
 * getFileList
 *
 * @param string $dir_path
 */
function getFileList($dir_path)
{
    $file_list = array();
    $dir = opendir($dir_path);
    if ($dir == false) {
        return false;
    }
    while ($file_path = readdir($dir)) {
        $full_path = $dir_path . '/' . $file_path;
        if (is_file($full_path)) {
            // テストケースのファイルのみ読み込む
            if (preg_match('/^(Ethna_)(.*)(_Test.php)$/', $file_path, $matches)) {
                $file_list[] = $full_path;
            }
            // サブディレクトリがある場合は,再帰的に読み込む.
            // "."で始まるディレクトリは読み込まない.
        } else {
            if (is_dir($full_path) && !preg_match('/^\\./', $file_path, $matches)) {
                $file_list = array_merge($file_list, getFileList($full_path));
            }
        }
    }
    closedir($dir);
    return $file_list;
}
开发者ID:hiroki-namekawa,项目名称:test-upr,代码行数:30,代码来源:ethna_run_test.php


示例4: runProducer

function runProducer()
{
    //读取FTP的下载的xml源文件列表
    $kmlPath = '/home/webdata/xml';
    $xml_file = getFileList($kmlPath);
    if (empty($xml_file)) {
        echo date('Y-m-d h:i:m') . "XML source files downloaded from the FTP is empty.", PHP_EOF;
        exit;
    }
    sort($xml_file);
    $startTime = explode(' ', microtime());
    $totalNum = 0;
    $i = $n = 1;
    foreach ($xml_file as $f) {
        //解析文件生成数组
        $data = paseXml($f);
        //XML格式检查
        $res = isFormat($data, $f);
        if ($res === false) {
            continue;
        }
        //格式化
        $kmldata = formatKmlData($data, $f);
        $i++;
        $fNum = count($kmldata);
        $totalNum += $fNum;
        //入队列
        $kafkaTime = explode(' ', microtime());
        echo $i . '>>>' . $f . ',file count:' . $fNum . ',total:' . $totalNum . "/n";
        //备份文件:
        //        backFile($f);
    }
    echo 'Total time:' . getTime($startTime) . '/n';
}
开发者ID:huangyaxiong,项目名称:kafka_php_api,代码行数:34,代码来源:countxml.php


示例5: get_imgedit_cache

/**
 * 得到编辑图片素材
 *
 * @param string;
 * return array;
 */
function get_imgedit_cache($cache_file, $path)
{
    if (!file_exists($cache_file)) {
        $data = getFileList($path);
        file_put_contents($cache_file, "<?php\n\$data=" . var_export($data, true) . ";\n?>");
        //echo 'creat<br>';
        return $data;
    }
    require $cache_file;
    return $data;
}
开发者ID:noikiy,项目名称:zays,代码行数:17,代码来源:function.php


示例6: getFilelist

function getFilelist($dir)
{
    global $rFiles;
    $files = glob($dir . '/*');
    foreach ($files as $f) {
        if (is_dir($f)) {
            getFileList($f);
            continue;
        }
        $rFiles[] = $f;
    }
}
开发者ID:vih,项目名称:kursuscenter.vih.dk,代码行数:12,代码来源:makepackage.php


示例7: getIndexFile

function getIndexFile($dir)
{
    $files = getFileList($dir);
    $indexFile;
    foreach ($files as $file) {
        if ($file['type'] == "text/html") {
            $indexFile = $file['name'];
            continue;
        }
    }
    return $indexFile;
}
开发者ID:AdrianSane,项目名称:Projects,代码行数:12,代码来源:index.php


示例8: getFileList

function getFileList($dir)
{
    $files = glob(rtrim($dir, '/') . '/*');
    $list = array();
    foreach ($files as $file) {
        if (is_file($file)) {
            $list[] = $file;
        }
        if (is_dir($file)) {
            $list = array_merge($list, getFileList($file));
        }
    }
    return $list;
}
开发者ID:zer0004,项目名称:auction_obo,代码行数:14,代码来源:log_status.php


示例9: runConsumer

function runConsumer($topic)
{
    $lockfile = '/tmp/mytest.lock';
    $startTime = explode(' ', microtime());
    $kmlCachePath = getconfig('kmlCachePath');
    //本地缓存里存在数据则优先执行
    $cacheFiles = getFileList('./cache/' . $topic);
    if (!empty($cacheFiles)) {
        sort($cacheFiles);
        foreach ($cacheFiles as $f) {
            $kmls = json_decode(file_get_contents($f));
            $items = array_chunk($kmls, 25);
            foreach ($items as $item) {
                updataKml($item, $startTime, $f, 2, $topic);
            }
        }
    }
    //  $i = 1;
    $f = '';
    logs(date('h:i:s', time()) . $topic . ' start ...', 1, 'consumer', $topic);
    while ($da = kafka::getInstance()->get($topic)) {
        $starttime = explode(' ', microtime());
        if (!empty($da->messageList)) {
            foreach ($da->messageList as $d) {
                $kmls[] = json_decode($d->message);
            }
            //$i++;
            //if($i > 10){
            updataKml($kmls, $starttime, $f, 1, $topic);
            usleep(10);
            logs(date('H:i:s') . 'sleep 10', 1, 'consumer', $topic);
            $kmls = [];
            /*    $i = 1;
                      }
                  }else{
                      if(!empty($kmls)){
                         updataKml($kmls,$starttime,$f,1, $topic);
                      }
                      break;*/
        } else {
            unlink($lockfile);
            logs('success total time:' . getTime($startTime), 1, 'consumer', $topic);
            echo 'aa';
            exit;
        }
    }
    logs('success total time:' . getTime($startTime), 1, 'consumer', $topic);
    unlink($lockfile);
}
开发者ID:huangyaxiong,项目名称:kafka_php_api,代码行数:49,代码来源:consumer.php


示例10: getFileList

function getFileList($dir)
{
    $files = glob(rtrim($dir, '/') . '/*html');
    $list = array();
    foreach ($files as $file) {
        if (is_file($file)) {
            $list[] = $file;
        }
    }
    $dirs = glob(rtrim($dir, '/') . '/*', GLOB_ONLYDIR);
    foreach ($dirs as $d) {
        $list = array_merge($list, getFileList($d));
    }
    return $list;
}
开发者ID:nobu222,项目名称:myShellScripts,代码行数:15,代码来源:link.php


示例11: writePhpList

/**
 * 
 * @param type $oFile
 * @param type $sDir
 * @param type $sRootPath
 */
function writePhpList($oFile, $sDir, $sRootPath)
{
    $aFile = getFileList($sDir);
    for ($i = 0; $i < count($aFile); $i++) {
        $sTemp = str_replace($sRootPath, ".", $aFile[$i]);
        $sTemp = str_replace("\\", "/", $sTemp);
        fwrite($oFile, $sTemp . "\n");
    }
    $aSubDir = getSubDir($sDir);
    if ($aSubDir != false) {
        for ($i = 0; $i < count($aSubDir); $i++) {
            writePhpList($oFile, $aSubDir[$i], $sRootPath);
        }
    }
}
开发者ID:soft456,项目名称:miniPhpTools,代码行数:21,代码来源:makePhpList.php


示例12: writeList

function writeList($dir)
{
    $list = getFileList($dir);
    if (count($list !== 0)) {
        echo "<ol>";
        foreach ($list as $value) {
            //ファイル名
            $fileName = pathinfo($value)["basename"];
            // echo $fileName;
            if ($fileName === "index.html" || $fileName === "index.php") {
                echo "<li><a href='" . $value . "'>" . pathinfo($value)["dirname"] . "</a></li>";
            }
        }
        echo "</ol>";
    }
}
开发者ID:kamotsuyo,项目名称:PHPfileRead,代码行数:16,代码来源:index.php


示例13: runProducer

function runProducer()
{
    $kmlPath = getconfig('kmlPath');
    $xml_file = getFileList($kmlPath);
    $lockfile = '/tmp/producer.lock';
    if (empty($xml_file)) {
        logs(date('Y-m-d h:i:m') . "XML source files downloaded from the FTP is empty.");
        unlink($lockfile);
        exit;
    }
    sort($xml_file);
    $startTime = explode(' ', microtime());
    $totalNum = 0;
    $i = $n = 1;
    foreach ($xml_file as $f) {
        //解析文件生成数组
        $data = paseXml($f);
        //XML格式检查
        $res = isFormat($data, $f);
        if ($res === false) {
            continue;
        }
        //格式化
        $kmldata = formatKmlData($data, $f);
        $i++;
        $fNum = count($kmldata);
        $totalNum += $fNum;
        //入队列
        $kafkaTime = explode(' ', microtime());
        $fileName = basename($f);
        insertKafka($kmldata, $fileName);
        logs($i . '>>>' . basename($f) . ',file count:' . $fNum . ',total:' . $totalNum . ',into kafka time:' . getTime($kafkaTime));
        if ($n > 100) {
            usleep(200);
            $n = 1;
        }
        //备份文件:
        backFile($f);
    }
    logs('Total time:' . getTime($startTime));
    //unlock();
    //$lockfile = '/tmp/producer.lock';
    unlink($lockfile);
    exit;
}
开发者ID:huangyaxiong,项目名称:kafka_php_api,代码行数:45,代码来源:producer.php


示例14: getFileList

function getFileList($dir)
{
    $files = scandir($dir);
    $files = array_filter($files, function ($file) {
        return !in_array($file, array('.', '..'));
    });
    $list = array();
    foreach ($files as $file) {
        $fullpath = rtrim($dir, '/') . '/' . $file;
        if (is_file($fullpath)) {
            $list[] = $fullpath;
        }
        if (is_dir($fullpath)) {
            $list = array_merge($list, getFileList($fullpath));
        }
    }
    return $list;
}
开发者ID:ryookinawa,项目名称:contentsControl,代码行数:18,代码来源:dirindex.php


示例15: getFileList

function getFileList($root, $basePath = '')
{
    $files = [];
    $handle = opendir($root);
    while (($path = readdir($handle)) !== false) {
        if ($path === '.svn' || $path === '.' || $path === '..') {
            continue;
        }
        $fullPath = "{$root}/{$path}";
        $relativePath = $basePath === '' ? $path : "{$basePath}/{$path}";
        if (is_dir($fullPath)) {
            $files = array_merge($files, getFileList($fullPath, $relativePath));
        } else {
            $files[] = $relativePath;
        }
    }
    closedir($handle);
    return $files;
}
开发者ID:cmsgears,项目名称:template-basic,代码行数:19,代码来源:init.php


示例16: getLocationURL

function getLocationURL($mode)
{
    $fileList = getFileList();
    $baseURL = $mode == "goto_pc" ? $fileList[0][0] : $fileList[0][1];
    foreach ($fileList as $line) {
        list($pcURL, $spURL) = $line;
        if ($mode == "goto_pc") {
            $csvData[trim($spURL)] = trim($pcURL);
        } else {
            $csvData[trim($pcURL)] = trim($spURL);
        }
    }
    if ($_SERVER['HTTP_REFERER']) {
        $refURL = str_replace("index.html", "", $_SERVER['HTTP_REFERER']);
        $refURL = str_replace("index.php", "", $refURL);
        $refDirName = dirname($_SERVER['HTTP_REFERER']);
        if (isset($csvData[$refURL]) && $csvData[$refURL]) {
            $url = $csvData[$refURL];
            if (!strstr($_SERVER['SERVER_NAME'], 'doc2root.net') && !strstr($_SERVER['SERVER_NAME'], 'biyo-ad.com') && !strstr($_SERVER['SERVER_NAME'], 'test.')) {
                $urlcheck = @file_get_contents($url);
                if (!$urlcheck) {
                    $url = $baseURL;
                }
            }
        } else {
            if (isset($csvData[$refDirName . '/*']) && $csvData[$refDirName . '/*']) {
                $url = !strstr($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'] . '/sp') ? str_replace($_SERVER['HTTP_HOST'], $_SERVER['HTTP_HOST'] . '/sp', $_SERVER['HTTP_REFERER']) : str_replace($_SERVER['HTTP_HOST'] . '/sp', $_SERVER['HTTP_HOST'], $_SERVER['HTTP_REFERER']);
                if (!strstr($_SERVER['SERVER_NAME'], 'doc2root.net') && !strstr($_SERVER['SERVER_NAME'], 'biyo-ad.com') && !strstr($_SERVER['SERVER_NAME'], 'test.')) {
                    $urlcheck = @file_get_contents($url);
                    if (!$urlcheck) {
                        $url = $baseURL;
                    }
                }
            } else {
                $url = $baseURL;
            }
        }
    } else {
        $url = $baseURL;
    }
    return $url;
}
开发者ID:aim-web-projects,项目名称:ann-cosme,代码行数:42,代码来源:config.php


示例17: getFileList

/**
 * @param       $dir
 * @param null  $filter
 * @param array $results
 * @return array
 */
function getFileList($dir, $filter = null, &$results = array())
{
    $files = scandir($dir);
    global $config;
    foreach ($files as $key => $value) {
        $path = $dir . DIRECTORY_SEPARATOR . $value;
        if (!is_dir($path) && !in_array($value, $config['exclude'], true)) {
            if ($filter) {
                if (preg_match('#' . $filter . '#iu', $path)) {
                    $results[] = realpath($path);
                }
            } else {
                $results[] = realpath($path);
            }
        } elseif (is_dir($path) && !in_array($value, $config['exclude'], true)) {
            getFileList($path, $filter, $results);
        }
    }
    return $results;
}
开发者ID:jbzoo,项目名称:skeleton-php,代码行数:26,代码来源:new-project.php


示例18: getFileList

function getFileList($dir)
{
    $files = scandir($dir);
    $files = array_filter($files, function ($file) {
        return !in_array($file, array('.', '..'));
    });
    $list = array();
    foreach ($files as $file) {
        $path = rtrim($dir, '/') . '/' . $file;
        $htmlExtIndex = strpos($path, 'index.html');
        if (is_file($path) && $htmlExtIndex) {
            $fullpath = substr($path, 2, $htmlExtIndex - 2);
            $dirs = explode('/', $fullpath);
            $data = array('name' => "jquery.{$dirs['2']}.js", 'href' => $fullpath, 'dirs' => $dirs[1]);
            if ($dirs[2] != '') {
                $list[] = $data;
            }
        }
        if (is_dir($path)) {
            $list = array_merge($list, getFileList($path));
        }
    }
    return $list;
}
开发者ID:Takepepe,项目名称:jquery-plugin-babel,代码行数:24,代码来源:getLinks.php


示例19: getFileList

function getFileList($dir)
{
    $retorno = '';
    if (substr($dir, -1) != "/") {
        $dir .= "";
    }
    $d = @dir($dir) or die("ERROR 404");
    // Directorio no encontrado
    while (false !== ($entry = $d->read())) {
        if ($entry[0] == ".") {
            continue;
        }
        // Saltear archivos ocultos (inician con ".")
        if (is_dir("{$dir}{$entry}")) {
            $retorno .= getFileList("{$dir}{$entry}/");
            // Ingresamos al subdirectorio
        } elseif (is_readable("{$dir}{$entry}")) {
            $retorno .= remove_up_dir("{$dir}{$entry}") . "|" . filesize("{$dir}{$entry}") . "|" . strtoupper(md5_file("{$dir}{$entry}")) . chr(10);
            // Archivo
        }
    }
    $d->close();
    return $retorno;
}
开发者ID:GoDKeR,项目名称:GS-Zone-AO,代码行数:24,代码来源:list_update.php


示例20: getFileList

function getFileList($dir)
{
    //$files = glob(rtrim($dir, '/') . '/*');
    $dir = rtrim($dir, '/') . '/*';
    $files = glob($dir . '{*.pdf,*.PDF}', GLOB_BRACE);
    $list = array();
    foreach ($files as $file) {
        if (is_file($file)) {
            $list[] = $file;
        }
        if (is_dir($file)) {
            $list = array_merge($list, getFileList($file));
        }
    }
    return $list;
}
开发者ID:JFLABO,项目名称:lifelog,代码行数:16,代码来源:index.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP getFileName函数代码示例发布时间:2022-05-15
下一篇:
PHP getFileExtention函数代码示例发布时间: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