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

PHP getAllFiles函数代码示例

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

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



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

示例1: getPageList

 public function getPageList()
 {
     $tmpl = $_REQUEST['tmpl'];
     $arr = getAllFiles(FANWE_ROOT . "/tpl/" . $tmpl . "/");
     foreach ($arr as $item) {
         if (substr($item, -4) == ".htm") {
             $item = preg_replace("/.htm/", "", $item);
             $item = explode("/" . $tmpl . "/", $item);
             $item = $item[1];
             $files[] = $item;
         }
     }
     $xml = simplexml_load_file(FANWE_ROOT . "/tpl/" . $tmpl . "/pages.xml");
     $pages = array();
     if ($xml) {
         $xml = (array) $xml;
         foreach ($xml['page'] as $item) {
             $item = (array) $item;
             if (count($item['file']) == 0) {
                 $item['file'] = '';
             }
             $pages[] = $item;
         }
     }
     $res['files'] = $files;
     $res['pages'] = $pages;
     echo json_encode($res);
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:28,代码来源:AdvLayoutAction.class.php


示例2: deleteOldLocalFiles

function deleteOldLocalFiles()
{
    $intBackupsToKeep = 2;
    //keep 2 weekly backups locally.  Locally is really just a staging area.  the real backups are kept on rackspace cloud files
    $arrAllFiles = getAllFiles();
    $arrDistinctPrefixes = filterDistinctPrefixes($arrAllFiles);
    if (count($arrDistinctPrefixes) > $intBackupsToKeep) {
        //if we have more backups than we want to keep, build a deletion list
        //rsort the array so we keep the 0-1 array positions, and chop off the rest.
        rsort($arrDistinctPrefixes);
        $arrPrefixesToKeep = array_slice($arrDistinctPrefixes, 0, $intBackupsToKeep);
        $arrFilesToDelete = array();
        foreach ($arrAllFiles as $value) {
            $dateVal = getDatePrefix($value);
            if ($dateVal != '') {
                if (!in_array($dateVal, $arrPrefixesToKeep)) {
                    //if the file has a prefix which isn't in the list of prefixes to keep, add it to the delete list
                    array_push($arrFilesToDelete, $value);
                }
            }
        }
        echo "Deleting older LOCAL backups.  There are currently " . count($arrDistinctPrefixes) . " weeks worth of an allowed " . $intBackupsToKeep . ".  Deleting " . (count($arrDistinctPrefixes) - $intBackupsToKeep) . " weeks worth.\n";
        $intDelete = 1;
        $intTotalDeletes = count($arrFilesToDelete);
        foreach ($arrFilesToDelete as $value) {
            echo "Deleting Object: " . $value . " (" . $intDelete . " of " . $intTotalDeletes . ")\n";
            unlink('data/' . $value);
            $intDelete++;
        }
    }
}
开发者ID:robertjustjones,项目名称:salesforceDataBackup,代码行数:31,代码来源:getData.php


示例3: getFilesTimestamp

function getFilesTimestamp($directory, $recursive = true)
{
    $allFiles = getAllFiles($directory, $recursive);
    $fileArray = array();
    foreach ($allFiles as $val) {
        $timeResult['file'] = $val;
        $timeResult['timestamp'] = filemtime($val);
        $fileArray[] = $timeResult;
    }
    return $fileArray;
}
开发者ID:emildev35,项目名称:processmaker,代码行数:11,代码来源:deleteSessions.php


示例4: getAllFiles

function getAllFiles($filedir, $fileType, $exclude)
{
    $allfiles = array();
    //文件名数组
    if (is_dir($filedir)) {
        //判断要遍历的是否是目录
        if ($dh = opendir($filedir)) {
            //打开目录并赋值一个目录句柄(directory handle)
            while (FALSE !== ($filestring = readdir($dh))) {
                //读取目录中的文件名
                if ($filestring != '.' && $filestring != '..' && !preg_match("/\\.svn\$/", $filestring) && !preg_match("/data\$/", $filestring) && !preg_match("/tools\$/", $filestring) && !preg_match("/ipad\$/", $filestring) && !preg_match("/import\\.js\$/", $filestring)) {
                    //如果不是.和..(每个目录下都默认有.和..)
                    if (is_dir($filedir . $filestring)) {
                        //该文件名是一个目录时
                        if (!$exclude || $exclude && !preg_match("/{$exclude}/", $filedir . $filestring)) {
                            $tempArr = getAllFiles($filedir . $filestring . '/', $fileType, $exclude);
                            //继续遍历该子目录
                            $allfiles = array_merge($allfiles, $tempArr);
                            //把临时文件名和临时文件名组合
                        }
                    } else {
                        if (is_file($filedir . $filestring)) {
                            //如果该文件名是一个文件不是目录,直接赋值给文件名数组
                            if (preg_match("/{$fileType}/", $filedir . $filestring)) {
                                $allfiles[] = $filedir . $filestring;
                                //                                                                }
                            }
                        }
                    }
                }
            }
        } else {
            //打开目录失败
            exit('Open the directory failed');
        }
        closedir($dh);
        //关闭目录句柄
        return $allfiles;
        //返回文件名数组
    } else {
        //目录不存在
        echo "{$filedir}";
        exit('The directory does not exist');
    }
}
开发者ID:41835478,项目名称:GMU,代码行数:45,代码来源:filehelper.php


示例5: getAllFiles

/**
 * 获取指定目录下的所有文件,返回一个数组,数组元素为文件的实际路径
 * @param $dir
 * @return array
 */
function getAllFiles($dir, $extension = 'php')
{
    $files = array();
    if (is_file($dir)) {
        if (pathinfo($dir, PATHINFO_EXTENSION) == $extension) {
            array_push($files, $dir);
        }
        return $files;
    }
    $folder = new DirectoryIterator($dir);
    foreach ($folder as $file) {
        if ($file->isFile()) {
            if (pathinfo($file, PATHINFO_EXTENSION) == $extension) {
                array_push($files, $file->getRealPath());
            }
            continue;
        }
        if (!$file->isDot()) {
            $sub_files = getAllFiles($file->getRealPath(), $extension);
            $files = array_merge($files, $sub_files);
        }
    }
    return $files;
}
开发者ID:kdf5000,项目名称:easythink,代码行数:29,代码来源:rename.php


示例6: getOuterBoxTop

$page = "renameImages";
require '../../variables.php';
require '../../variablesdb.php';
require_once '../functions.php';
require_once './../../functions.php';
require_once '../../files/functions.php';
require '../../top.php';
echo getOuterBoxTop($leaguename . " <span class='grey-small'>&raquo;</span> Rename Videos", "");
?>
<?


$imagesDir = "./../../files/images/";
$thumbsDir = "./../../files/images/thumbnails/";

$filesList = getAllFiles($imagesDir);

$filesListRev = array ();
foreach ($filesList as $fileArray) {
	$modified = $fileArray[1];
	$filesListRev[] = array (
		$fileArray[1],
		$fileArray[0]
	);
}

$fullList = $filesListRev;

asort($fullList);
$i = 0;
开发者ID:kinj1987,项目名称:evo-league,代码行数:30,代码来源:renameImages.php


示例7: getAllFiles

function getAllFiles($path)
{
    $list = array();
    foreach (glob($path . '/*') as $item) {
        if (is_dir($item)) {
            $list = array_merge($list, getAllFiles($item));
        } else {
            $list[] = $item;
        }
    }
    return $list;
}
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:12,代码来源:~app.php


示例8: intval

<?php

require_once "config.inc.php";
$limit = intval($_GET['limit']);
$filetypes = array('jpg', 'jpeg', 'tif', 'tiff', 'raw', 'ai', 'pdf', 'eps', 'svg');
$ignore_extensions = array('db', 'dmg', 'xls', 'exe');
$ignore_filenames = array('DS_Store');
$existings = $db->query("SELECT * FROM `photos`");
$existing_files = array();
while ($existing = $existings->fetch_assoc()) {
    $existing_files[] = $existing['fullpath'];
}
$files = getAllFiles("./content/");
$starttime = time();
echo "<pre>Started at: " . date("Y-m-d H:i:s", $starttime) . ' ' . count($files) . " files</pre>";
$i = 0;
foreach ($files as $key => $file) {
    $f_info = pathinfo($file);
    $f_ext = trim(strtolower($f_info['extension']));
    if (!in_array($file, $existing_files) && substr($f_info['basename'], 0, 1) !== '.' && in_array($f_ext, $filetypes) && !in_array($f_info['basename'], $ignore_filenames)) {
        try {
            $imagesize = imgetimagesize($file);
        } catch (Exception $e) {
            echo "<pre>Error with file: {$file}\nSize:" . filesize($file) . "\nCaught exception: " . $e->getMessage() . "</pre>";
        }
        if (isset($imagesize['properties']['tiff:timestamp'])) {
            $filedate = strtotime($imagesize['properties']['tiff:timestamp']);
        } elseif (isset($imagesize['properties']['xap:CreateDate'])) {
            $filedate = strtotime($imagesize['properties']['xap:CreateDate']);
        } elseif (isset($imagesize['properties']['xmp:CreateDate'])) {
            $filedate = strtotime($imagesize['properties']['xmp:CreateDate']);
开发者ID:avryhof,项目名称:digital-asset-manager,代码行数:31,代码来源:indexer-init.php


示例9: preg_replace

$content = preg_replace($remove, '', $content);
$content = preg_replace($replace, '', $content);
$content = strip_tags($content);
$content = htmlspecialchars_decode($content);
preg_match_all('/./us', $content, $match);
$match[0] = array_unique($match[0]);
$unicode = array();
foreach ($match[0] as $char) {
    $unicode[] = nochaoscode("utf8", $char);
}
print_r($unicode);
exec("./generate_font.pe -font " . FONT_FILE . " " . implode(" ", $unicode));
//generate css files
$fontface = "";
$class = "";
getAllFiles("chars/", $files);
foreach ($files as $file) {
    $content = base64_encode(file_get_contents("chars/{$file}.ttf"));
    $fontface .= <<<FONT
@font-face {
    font-family: "{$file}";
    src: url("data:font/opentype;base64,{$content}");
}
FONT;
    $class .= <<<STYLE
.{$file} {
    font-family: {$file};
}
STYLE;
}
file_put_contents("font-face.css", $fontface);
开发者ID:Rongying,项目名称:font_process,代码行数:31,代码来源:font.php


示例10: array_keys

     $keys = array_keys($query);
     $total = count($keys);
     if ($total > 0) {
         for ($i = 0; $i < $total; $i++) {
             $key = $keys[$i];
             $pattern = $query[$key];
             if (is_string($pattern)) {
                 $patterns[$key] = patternToRegExp($pattern);
             }
         }
         $files = matchFiles($query, $patterns, $ignoreCase, ".", $rootDir, $deep, $dirsOnly, $expand, $showHiddenFiles);
     } else {
         $files = getAllFiles(".", $rootDir, $deep, $dirsOnly, $expand, $showHiddenFiles);
     }
 } else {
     $files = getAllFiles(".", $rootDir, $deep, $dirsOnly, $expand, $showHiddenFiles);
 }
 $total = count($files);
 //Handle the sorting and paging.
 $sortSpec = false;
 if (array_key_exists("sort", $_GET)) {
     $sortSpec = $_GET['sort'];
     $sortSpec = str_replace("\\\"", "\"", $sortSpec);
     $sortSpec = json_decode($sortSpec);
 }
 if ($sortSpec != null) {
     $comparator = createComparator($sortSpec);
     usort($files, array($comparator, "compare"));
 }
 //Page, if necessary.
 if (array_key_exists("start", $_GET)) {
开发者ID:hflw,项目名称:lucid,代码行数:31,代码来源:filestore_dojoxdata.php


示例11: getOuterBoxTop

$page = "populateGoals";
require '../../variables.php';
require '../../variablesdb.php';
require_once '../functions.php';
require_once './../../functions.php';
require_once './../../files/functions.php';
require '../../top.php';
echo getOuterBoxTop($leaguename . " <span class='grey-small'>&raquo;</span> Populate New", "");
?>
<?


$goalsDir = "./../../files/goals/";
$thumbsDir = "./../../files/goals/thumbnails/";

$filesList = getAllFiles($goalsDir);

$filesListRev = array ();

foreach ($filesList as $fileArray) {
	if (!is_dir($fileArray[0])) {
		$filesListRev[] = array (
			$fileArray[1],
			$fileArray[0]
		);
	}
}

$fullList = $filesListRev;

asort($fullList);
开发者ID:kinj1987,项目名称:evo-league,代码行数:31,代码来源:populateNew.php


示例12: applyTransformation

/**
 *
 * @param DOMDocument $xml puvodni XML
 * @param array|string $styles seznam xsl stylu
 * @return string
 */
function applyTransformation(DOMDocument $xml, $styles)
{
    if (!is_array($styles)) {
        $styles = array($styles);
    }
    if (empty($styles)) {
        $GLOBALS['xmlerrmsg'] .= "No styles found with given rule. Add some xslt files into plugin configuration after the rule\n";
    }
    $GLOBALS['xmlinfomsg'] .= "Applying transformation with following styles: " . implode(", ", $styles) . "\n";
    $backendOptions = array('cache_dir' => CACHE_DIR);
    $cache = Zend_Cache::factory('Core', 'File', array('lifetime' => null, 'automatic_serialization' => true), $backendOptions, false, false, true);
    if (isset($_GET['nocache'])) {
        $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
    }
    // ulozime datum posledni zmeny vsech souboru v xml adresari jako asociativni pole nazev_souboru => cas_zmeny
    $timestamp_cache_id = 'xml_timestamps';
    if (!($created = $cache->load($timestamp_cache_id))) {
        // smazeme radsi celou cache
        $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
        $created = array();
        $files = getAllFiles($GLOBALS['xml_path']);
        foreach ($files as $file) {
            $created[basename($file)] = filectime($file);
        }
        $cache->save($created, $timestamp_cache_id);
    }
    // projdeme datum posledni zmeny u prirazenych xslt sablon a pokud nesouhlasi, smazeme cache obsahujici tuto sablonu
    foreach ($styles as $style) {
        $ctime = filectime($GLOBALS['xml_path'] . $style);
        if ($ctime != $created[$style]) {
            // smazeme cache obsahujici tuto sablonu
            $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array(getMyTag($style)));
            // aktualizujeme datum
            $created[$style] = $ctime;
        }
        // ulozime cache obsahujici nove datum posledni zmeny xml
        $cache->save($created, $timestamp_cache_id);
    }
    // cacheId vytvoreno jako hash xml obsahu a jazyk
    // @todo zde se nekontroluje uzivatelsky vstup lang, zda je povolen
    $lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : '';
    if (!empty($lang)) {
        $GLOBALS['xmlinfomsg'] .= "Language from URL {$lang}\n";
    }
    if (empty($lang)) {
        $user = JFactory::getUser();
        $language = $user->getParam('language');
        $lang = substr($language, 0, 2);
        if (!empty($lang)) {
            $GLOBALS['xmlinfomsg'] .= "Setting user language {$lang}\n";
        }
    }
    // default transformation language is set in the xslt transformation
    $xml_params = array();
    foreach ($_GET as $key => $val) {
        if (substr($key, 0, 5) == "xslt_") {
            $mykey = substr($key, 5);
            $xml_params[$mykey] = $val;
        }
    }
    $cache_id = md5($xml->saveXML() . $lang . implode("_", $xml_params));
    if (!($result = $cache->load($cache_id))) {
        $tags = array();
        foreach ($styles as $style) {
            // otaguj cache pouzitou sablonou
            $tags[] = getMyTag($style);
            $xsl = new DOMDocument();
            $xsl->load($GLOBALS['xml_path'] . $style);
            $processor = new XSLTProcessor();
            $processor->importStyleSheet($xsl);
            if (!empty($lang)) {
                $processor->setParameter('', 'reportLang', $lang);
            }
            foreach ($xml_params as $key => $val) {
                $processor->setParameter('', $key, $val);
            }
            $xml = $processor->transformToDOC($xml);
        }
        // timto zpusobem vypustime uvodni xml deklaraci
        $result = '';
        foreach ($xml->childNodes as $node) {
            $result .= $xml->saveXML($node) . "\n";
        }
        $cache->save($result, $cache_id, $tags);
    }
    return $result;
}
开发者ID:KIZI,项目名称:sewebar-cms,代码行数:93,代码来源:xsltmagic.php


示例13: fread

    //is file exist
    if (file_exists($file_path)) {
        if ($fp = fopen($file_path, "a+")) {
            //read file
            $conn = fread($fp, filesize($file_path));
            return $conn;
        } else {
            die("file open fail.\n");
        }
    } else {
        die("no file exist.\n");
    }
    fclose($fp);
    return null;
}
$res_files = getAllFiles($res_dir);
for ($i = 0; $i < count($res_files); $i++) {
    $file_content = readAllFile($res_dir . "/" . $res_files[$i]);
    $now_content[substr($res_files[$i], 1)] = md5($file_content);
}
foreach ($now_content as $key => $value) {
    $file_name = $key;
    if (!array_key_exists($file_name, $version_content)) {
        $new_content[] = ["file" => $key, "md5" => $value, "operate" => "new"];
        continue;
    } else {
        if ($version_content[$key] != $value) {
            $new_content[] = ["file" => $key, "md5" => $value, "operate" => "update"];
        }
    }
}
开发者ID:hhhzaixian,项目名称:version_update,代码行数:31,代码来源:version_gen.php


示例14: foreach

        <legend>Upload your image</legend>
        <form action="<?php 
echo $_SERVER['PHP_SELF'];
?>
" method="POST" enctype="multipart/form-data" >
            <input type="file" name="image[]" multiple>
            <input type="submit"  value="Upload images" name="submit">
            <p><?php 
echo $message ?? '';
?>
</p>
        </form>
    </fieldset>
    <div id="content">
        <?php 
if ($allFiles = getAllFiles($targetPath)) {
    ?>
            <?php 
    foreach ($allFiles as $num => $file) {
        ?>
                <img src="<?php 
        echo $targetPath . '/' . $file;
        ?>
" alt="изображение-<?php 
        echo $num + 1;
        ?>
">
            <?php 
    }
    ?>
        <?php 
开发者ID:VyacheslavLynnyk,项目名称:php-academy.kiev.ua,代码行数:31,代码来源:index.php


示例15: listcase

 public static function listcase($matcher = "*")
 {
     require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "../../conf/config.php";
     require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'filehelper.php';
     $testdir = ConfigTest::$testdir;
     $caselist = array();
     $caselist = array_merge($caselist, getAllFiles($testdir, "\\.js\$", "fet"));
     foreach ($caselist as $caseitem) {
         if (!preg_match("/import\\.js/", $caseitem)) {
             /*将文件名替换为域名方式,替换/为.,移除.js*/
             $caseitem = str_replace($testdir, "", $caseitem);
             //$name = str_replace( '/' , '.' , substr( $caseitem , 0 , -3 ) );
             $name = substr($caseitem, 0, -3);
             //为了支持xx.xx.js类型的文件名而修改 田丽丽
             $c = new Testcase($name);
             if ($c->empty) {
                 continue;
             }
             $c->case_id = "id_case_" . str_replace('.', '__', $name);
             /* jiangshuguang 支持批量过滤,例如filter=webapp只保留webapp的所有的case*/
             //                    if(!strpos($matcher,"/") && $matcher!="*"){
             //                        $mod=explode("/",$name);
             //                        if($mod[0]==$matcher){
             //                              print( "<a href=\"run.php?case=$name\" id=\"$c->case_id\" class=\"jsframe_qunit\" target=\"_blank\" title=\"$name\" onclick=\"run('$name');\$J('#id_rerun').html('$name');return false;\">"
             //                                  . $name . "</a>\n" );
             //                          }
             //                    }else{
             if ($c->match($matcher)) {
                 print "<a href=\"run.php?case={$name}\" id=\"{$c->case_id}\" class=\"jsframe_qunit\" target=\"_blank\" title=\"{$name}\" onclick=\"run('{$name}');\$J('#id_rerun').html('{$name}');return false;\">" . $name . "</a>\n";
             }
             //                    }
         }
     }
 }
开发者ID:41835478,项目名称:GMU,代码行数:34,代码来源:case.class.php


示例16: getAllFiles

 private function getAllFiles($directory, $recursive = true)
 {
     $result = array();
     if (is_dir($directory)) {
         $handle = opendir($directory);
         while ($datei = readdir($handle)) {
             if ($datei != '.' && $datei != '..') {
                 $file = $directory . $datei;
                 if (is_dir($file)) {
                     if ($recursive) {
                         $result = array_merge($result, getAllFiles($file . '/'));
                     }
                 } else {
                     $result[] = $file;
                 }
             }
         }
         closedir($handle);
     }
     return $result;
 }
开发者ID:bqevin,项目名称:processmaker,代码行数:21,代码来源:class.rbac.php


示例17: getAllFiles

<?php

function getAllFiles($path)
{
    $dataArr = scandir($path);
    foreach ($dataArr as $data) {
        if (is_dir($data)) {
            continue;
        }
        $files[] = $data;
    }
    return sizeof($files) ? $files : false;
}
$allFiles = getAllFiles('.');
foreach ($allFiles as $file) {
    echo $file . '<br>';
}
开发者ID:VyacheslavLynnyk,项目名称:php-academy.kiev.ua,代码行数:17,代码来源:04.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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