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

PHP getfiles函数代码示例

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

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



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

示例1: do_handle

 public function do_handle()
 {
     $allowFiles = substr(str_replace(".", "|", join("", $this->allowFiles)), 1);
     /* 获取参数 */
     $size = isset($_GET['size']) ? htmlspecialchars($_GET['size']) : $this->listSize;
     $start = isset($_GET['start']) ? htmlspecialchars($_GET['start']) : 0;
     $end = $start + $size;
     /* 获取文件列表 */
     $path = $_SERVER['DOCUMENT_ROOT'] . (substr($this->path, 0, 1) == "/" ? "" : "/") . $path;
     $files = getfiles($path, $allowFiles);
     if (!count($files)) {
         return json_encode(array("state" => "no match file", "list" => array(), "start" => $start, "total" => count($files)));
     }
     /* 获取指定范围的列表 */
     $len = count($files);
     for ($i = min($end, $len) - 1, $list = array(); $i < $len && $i >= 0 && $i >= $start; $i--) {
         $list[] = $files[$i];
     }
     //倒序
     //for ($i = $end, $list = array(); $i < $len && $i < $end; $i++){
     //    $list[] = $files[$i];
     //}
     /* 返回数据 */
     $result = json_encode(array("state" => "SUCCESS", "list" => $list, "start" => $start, "total" => count($files)));
     return $result;
 }
开发者ID:AlusaChen,项目名称:test-lar,代码行数:26,代码来源:ListImages.php


示例2: smarty_function_randphoto

function smarty_function_randphoto($_params, &$_smarty)
{
    $bgdir = $_params['pageinfo']->cssdir . '/bgs/';
    $bgfiles = getfiles($bgdir);
    $filenum = rand(0, count($bgfiles) - 1);
    return $_params['pageinfo']->cssurl . '/bgs/' . $bgfiles[$filenum];
}
开发者ID:bcipolli,项目名称:website-old-php,代码行数:7,代码来源:function.randphoto.php


示例3: sadmindeleteitem

function sadmindeleteitem($id)
{
    global $module_filepath, $Q, $DB, $module_name;
    $query = "SELECT * FROM " . $module_name . " where rid=" . $id;
    $Q->query($DB, $query);
    $count = $Q->numrows();
    $recs = "";
    for ($i = 0; $i < $count; $i++) {
        $row = $Q->getrow();
        $recs[$i] = $row[id];
    }
    for ($i = 0; $i < $count; $i++) {
        sadmindeleteitem($recs[$i]);
    }
    // ATTACHMENTS
    $ppath = $module_filepath . "/attachments/" . $id . "/";
    $mas = getfiles($ppath);
    if ($mas[0] != "") {
        for ($j = 0; $j < count($mas); $j++) {
            unlink($ppath . $mas[$j]);
        }
    }
    $query = "DELETE from " . $module_name . " WHERE id=" . $id;
    //echo $query."<br>";
    $Q->query($DB, $query);
}
开发者ID:pioytazsko,项目名称:drell,代码行数:26,代码来源:_delete.php


示例4: getfiles

/**
 * 遍历获取目录下的指定类型的文件
 * @param $path
 * @param array $files
 * @return array
 */
function getfiles($path, $allowFiles, &$files = array())
{
    global $_M;
    if (!is_dir($path)) {
        return null;
    }
    if (substr($path, strlen($path) - 1) != '/') {
        $path .= '/';
    }
    $handle = opendir($path);
    while (false !== ($file = readdir($handle))) {
        if ($file != '.' && $file != '..') {
            $path2 = $path . $file;
            if (is_dir($path2)) {
                getfiles($path2, $allowFiles, $files);
            } else {
                if (preg_match("/\\.(" . $allowFiles . ")\$/i", $file)) {
                    $url = str_replace(PATH_WEB, $_M['url']['site'], $path2);
                    if (!strstr($url, 'thumb_dis/') && !strstr($url, 'thumb/') && !strstr($url, 'watermark/') && !strstr($url, 'upload/_thumbs/') && !strstr($url, 'upload/thumb_src/') && !strstr($url, 'upload/files/') && !strstr($url, 'upload/images/')) {
                        $files[] = array('url' => $url, 'mtime' => filemtime($path2));
                    }
                }
            }
        }
    }
    return $files;
}
开发者ID:nanfs,项目名称:lt,代码行数:33,代码来源:action_list.php


示例5: smarty_function_randphoto

function smarty_function_randphoto($_params, &$_smarty)
{
    $pageinfo = $_smarty->tpl_vars['pageinfo']->value;
    $bgdir = $pageinfo['cssdir'] . '/bgs/';
    $bgfiles = getfiles($bgdir);
    $filenum = rand(0, count($bgfiles) - 1);
    return $pageinfo['cssurl'] . '/bgs/' . $bgfiles[$filenum];
}
开发者ID:bcipolli,项目名称:website-old-php,代码行数:8,代码来源:function.randphoto.php


示例6: copyallfiles

function copyallfiles($dirfrom, $dirto)
{
    $filesfrom = getfiles($dirfrom);
    if (!$filesfrom) {
        return 0;
    }
    for ($i = 0; $i < count($filesfrom); $i++) {
        $file1 = $dirfrom . "/" . $filesfrom[$i];
        $file2 = $dirto . "/" . $filesfrom[$i];
        copy($file1, $file2);
        //	echo "$file1 $file2<br>";
    }
    echo "<p>";
}
开发者ID:pioytazsko,项目名称:drell,代码行数:14,代码来源:_copyto.php


示例7: getfiles

function getfiles($dir, &$files = array())
{
    if (!file_exists($dir) || !is_dir($dir)) {
        return;
    }
    if (substr($dir, -1) == '/') {
        $dir = substr($dir, 0, strlen($dir) - 1);
    }
    $_files = scandir($dir);
    foreach ($_files as $v) {
        if ($v != '.' && $v != '..') {
            if (is_dir($dir . '/' . $v)) {
                getfiles($dir . '/' . $v, $files);
            } else {
                $files[] = $dir . '/' . $v;
            }
        }
    }
    return $files;
}
开发者ID:vb2005xu,项目名称:automake-apk-php,代码行数:20,代码来源:markapk.php


示例8: getfiles

/**
 * 遍历获取目录下的指定类型的文件
 * @param  	 $path
 * @param  	 array $files
 * @return 	 array
 */
function getfiles($path, &$files = array())
{
    if (!is_dir($path)) {
        return null;
    }
    $handle = opendir($path);
    while (false !== ($file = readdir($handle))) {
        if ($file != '.' && $file != '..') {
            $path2 = $path . '/' . $file;
            if (is_dir($path2)) {
                getfiles($path2, $files);
            } else {
                if (preg_match("/\\.(gif|jpeg|jpg|png|bmp)\$/i", $file)) {
                    $files[] = $path2;
                }
            }
        }
    }
    return $files;
}
开发者ID:PoppyLi,项目名称:PCMS,代码行数:26,代码来源:file_helper.php


示例9: getfiles

/**
 * 遍历获取目录下的指定类型的文件
 * @param $path
 * @param array $files
 * @return array
 */
function getfiles($path, $allowFiles, $APPCONFIG, &$files = array())
{
    if (!is_dir($path)) {
        return null;
    }
    if (substr($path, strlen($path) - 1) != '/') {
        $path .= '/';
    }
    $handle = opendir($path);
    while (false !== ($file = readdir($handle))) {
        if ($file != '.' && $file != '..') {
            $path2 = $path . $file;
            if (is_dir($path2)) {
                getfiles($path2, $allowFiles, $APPCONFIG, $files);
            } else {
                if (preg_match("/\\.(" . $allowFiles . ")\$/i", $file)) {
                    $files[] = array('url' => $APPCONFIG['sys_images_domain'] . substr($path2, strlen($APPCONFIG['sys_upload_path'])), 'mtime' => filemtime($path2));
                }
            }
        }
    }
    return $files;
}
开发者ID:mikegit2014,项目名称:laravelback,代码行数:29,代码来源:action_list.php


示例10: getfiles

/**
 * 遍历获取目录下的指定类型的文件
 * @param $path
 * @param array $files
 * @return array
 */
function getfiles($path, $allowFiles, &$files = array())
{
    if (!is_dir($path)) {
        return null;
    }
    if (substr($path, strlen($path) - 1) != '/') {
        $path .= '/';
    }
    $handle = opendir($path);
    while (false !== ($file = readdir($handle))) {
        if ($file != '.' && $file != '..') {
            $path2 = $path . $file;
            if (is_dir($path2)) {
                getfiles($path2, $allowFiles, $files);
            } else {
                if (preg_match("/\\.(" . $allowFiles . ")\$/i", $file)) {
                    $files[] = array('url' => substr($path2, strlen($_SERVER['DOCUMENT_ROOT'])), 'mtime' => filemtime($path2));
                }
            }
        }
    }
    return $files;
}
开发者ID:heroshadow,项目名称:shop,代码行数:29,代码来源:action_list.php


示例11: getfiles_pictures

$pic = "images/pic.jpg";
if (file_exists("attachments/" . $_GET[id] . "/big.jpg")) {
    $pic = "attachments/" . $_GET[id] . "/big.jpg";
}
if (file_exists("attachments/" . $_GET[id] . "/1.jpg")) {
    $pic = "attachments/" . $_GET[id] . "/1.jpg";
}
$small_pics = "";
$pics = getfiles_pictures("attachments/" . $_GET[id] . "/");
for ($i = 0; $i < count($pics); $i++) {
    if (!ereg("big\\.jpg", $pics[$i]) && ereg("[0-9]+", $pics[$i]) && $pics[$i] != "1.jpg") {
        $small_pics .= "\n\t\t<tr valign='top'>\n\t\t\t<td class='vtable'><a href='/attachments/" . $_GET[id] . "/" . $pics[$i] . "' alt='" . $product[name] . "' title='" . $product[name] . "' rel='lightbox[images]'><img src='shortimage.php?path=attachments--" . $_GET[id] . "--" . $pics[$i] . "&x=41&y=41' border='0'/></a></td>\n\t\t</tr>\n\t\t";
    }
}
$instruction = "";
$files = getfiles("attachments/" . $_GET[id] . "/");
for ($i = 0; $i < count($files); $i++) {
    $ext = split("\\.", $files[$i]);
    $ext = $ext[count($ext) - 1];
    if ($ext == "pdf") {
        $instruction = "/attachments/" . $_GET[id] . "/" . $files[$i];
    }
}
?>
<td valign="top">
 	  <table id="Table2" width="100%"  border="0" cellpadding="0"  cellspacing="0"><tr height="1px" valign="top"><td  align="left" style="padding-left:20px;padding-top:10px; padding-right:25px;">
		<table id="Table" width="100%"  border="0" cellpadding="0"  cellspacing="0">
			<tr height="1px" valign="middle">
			<td style="padding-top:5px;"><p style="margin:0px;padding-top:10px;"></p><h1 class="nobottomed"><?php 
echo $product[name];
?>
开发者ID:pioytazsko,项目名称:drell,代码行数:31,代码来源:_new_center_product.php


示例12: getparams

<?php

// version 1.03, 12/03/2012;
// example usage: gallery.php?start=14&len=12
require 'common.php';
getparams();
$status = getdirs();
if ($status == 0) {
    print "directory \"{$archive_dir}\" not found<br>";
    exit;
}
getfiles();
header('content-type: text/html; charset=utf-8');
echo "<html><head><title>" . date("Y M d H:i:s", ftime($working_dir . "/" . $files[$start])) . "</title></head><body>";
navigation_top();
navigation_bottom();
// Gallery
echo "<p>";
if ($start > sizeof($files)) {
    $start = sizeof($files) - 1;
}
$last = $start + $len;
if ($last >= sizeof($files)) {
    $last = sizeof($files) - 1;
}
for ($count = $start; $count <= $last; $count++) {
    $filename = $files[$count];
    $smallname = $thumbdir . "/" . $filename;
    $smallname_abs = $root_dir . "/" . $smallname;
    if (file_exists($smallname_abs)) {
        echo "<a href='image.php?cam={$cam}&img={$filename}&dir={$dir}&i={$count}'><img src='" . $smallname . "' title='" . date("H:i:s", ftime($working_dir . "/" . $filename)) . "'></a> ";
开发者ID:jnavarroc,项目名称:mobilewebcam-serverside,代码行数:31,代码来源:gallery.php


示例13: preg_replace

    $wp = $_GET["whatpage"];
    $wp = preg_replace("/..\\//i", "", $wp);
    $myFile = ENGINE . 'news/' . $wp;
}
#$myFile=ENGINE.'newsdb.php';
$commentFile = ENGINE . 'commentsdb.php';
$newsperpage = 30;
//Список файлов в каталоге
function getfiles($inpath)
{
    if (sizeof($dir = scandir($inpath, 1)) > 1) {
        array_splice($dir, -2, 2);
    }
    return $dir;
}
$filesnews = getfiles(ENGINE . 'news/');
foreach ($filesnews as $file) {
    $file = basename($file, 'php');
    $all_files .= "|&nbsp;&nbsp;<a href=\"?whatpage={$file}\"> {$file}</a>&nbsp;&nbsp;|";
}
if (file_exists($myFile)) {
    //Запись
    if (!empty($_REQUEST['action'])) {
        $news = file($myFile);
        $countallnews = count($news);
        if ($edit > 0) {
            $new = unserialize($news[$edit - 1]);
            @($adminemail = $new['admmail']);
            @($idmess = $new['id']);
            @($time = $new['pubtime']);
            $head = filtermessage($_REQUEST['header']);
开发者ID:porese,项目名称:kandidat-cms,代码行数:31,代码来源:news.php


示例14: Array

fileIds=new Array();
<?php 
if (isset($id) && $id != "undefined") {
    $e = "";
    $filelink = "";
    $query = "select * from " . $module_name . " where lang='{$lang}' and aname='material'";
    $Q->query($DB, $query);
    $count = $Q->numrows();
    $ids[0] = $id;
    for ($i = 1; $i <= $count; $i++) {
        $row = $Q->getrow();
        $ids[$i] = $row[id];
    }
    for ($uy = 0; $uy <= $count; $uy++) {
        echo "fileIds[" . $ids[$uy] . "]=" . $uy . ";\n";
        $mas = getfiles($module_filepath . "/attachments/" . $ids[$uy] . "/");
        if ($mas[0] != "") {
            for ($i = 0; $i < count($mas); $i++) {
                $ppath[$i] = $module_filepath . "/attachments/" . $ids[$uy] . "/";
                $ppath[$i] = $ppath[$i] . $mas[$i];
            }
            //	$e[0]='<p><a class=\"filelink\"  id=\"ff0\" style=\"height:22px; margin:0px 0px 0px 0px;\" href=\"#\" onClick=\"javascript:highlight(\\\'ff0\\\');fileLink(\\\'..\\\');\" title=\"URL: #\"><img src=\"../../images/spacer.gif\" width=1 height=22 alt=\"\" border=\"0\" align=\"absmiddle\">..</a></p>';
            for ($i = 0; $i < count($mas); $i++) {
                $filesize = ceil(filesize($ppath[$i]) / 1000);
                $ext = split("\\.", mystrtohigher($mas[$i]));
                $ext = $ext[count($ext) - 1];
                $ext1 = strtolower($ext);
                $ext1 = ereg_replace("jpeg", "jpg", $ext1);
                $emp = "";
                if ($filesize > 0) {
                    if ($ext == "JPG" || $ext == "JPEG" || $ext == "GIF") {
开发者ID:pioytazsko,项目名称:drell,代码行数:31,代码来源:hyperlink.php


示例15: fopen

    $f = fopen($file, "r");
    $ln = 0;
    while (!feof($f)) {
        $line = fgets($f);
        ++$ln;
        //        echo $ln."\r\n";
        if ($line === FALSE) {
            print "FALSE\n";
        } elseif (contains($line, "scenarios (")) {
            $text = $line;
        }
    }
    fclose($f);
    return $text;
}
getfiles($dir);
//echo $body;
for ($i = 0; $i < count($result); $i++) {
    $temp = preg_replace("/.html/", "", $result[$i]);
    $temp = @split("_", $temp);
    $date[$i] = $temp[0];
    $app[$i] = $temp[1];
    $pt[$i] = $temp[2];
    $v[$i] = $temp[3];
}
for ($i = 0; $i < count($fullpath); $i++) {
    $text = Readlog($fullpath[$i]);
    $temp = @split("=", $text);
    //var_dump($temp);
    $find = "scenarios";
    $findLen = strlen($find);
开发者ID:emilymwang8,项目名称:applogplatform,代码行数:31,代码来源:report.php


示例16: foreach

}
?>
</div>
<?php 
echo '<table class="table table-bordered table-striped">';
echo '<thead><tr><th colspan="2">Checking for files need to be renamed</th></tr></thead>';
echo '<tbody>';
// Start Language Check
$rename = " must be renamed to ";
$language_file_count = 0;
foreach (glob("../languages/*.conf") as $filename) {
    $language_file_count = $language_file_count + 1;
}
if (!glob("../languages/*.conf")) {
    echo '<tr><td style="width:20px;" class="bad"><i class="fa fa-times"></i></td><td>No Language file has been detected! You will need to remove the .default extension from one of these language files:<ul style="margin:0px 0 5px 15px;padding:0;">';
    getfiles("../languages");
    // List language files
    echo '</ul></td></tr>';
} else {
    echo "<tr><td style='width:20px;' class='good'><i class='fa fa-check'></i></td><td>You have renamed ";
    echo '<a id="langfiles" data-trigger="hover" data-html="true" data-content="<ul>';
    foreach (glob("../languages/*.conf") as $filename) {
        echo "<li>{$filename}</li>";
    }
    echo '</ul>" rel="popover" href="#" data-original-title="Renamed Language Files">' . $language_file_count . ' language file(s)</a>, which are ready to be used</td></tr>' . "\n";
}
$settings = '../settings.php';
$settingsdefault = '../settings.php.default';
if (file_exists($settings)) {
    echo '<tr><td ckass="good"><i class="fa fa-check" ></i></td><td>' . $settings . '</td></tr>';
} else {
开发者ID:hyrmedia,项目名称:pligg-cms,代码行数:31,代码来源:troubleshooter.php


示例17: getfiles

    if ($file != '.' && $file != '..') {
        $path2 = $path . '/' . $file;
        if (is_dir($path2)) {
            getfiles($path2);
        } else {
            if (preg_match("/\\.(gif|jpeg|jpg|png|bmp)\$/i", $file)) {
                $files[] = $path . '/' . $file;
            }
        }
    }
}
$files1 = array();
if (!is_dir($path1)) {
    echo "not a dir";
}
$handle = opendir($path1);
while (false !== ($file = readdir($handle))) {
    if ($file != '.' && $file != '..') {
        $path2 = $path . '/' . $file;
        if (is_dir($path2)) {
            getfiles($path2);
        } else {
            if (preg_match("/\\.(gif|jpeg|jpg|png|bmp)\$/i", $file)) {
                $files1[] = $path1 . '/' . $file;
            }
        }
    }
}
?>

开发者ID:JasonBour,项目名称:js,代码行数:29,代码来源:showImages.php


示例18: getfiles

 </form>

</div>

<div id='selectFileDB'>

 <form id="fileVisList" action=""  method="post">
 <label for = "file" >Choose a file to Visualize</label>
 <br>

 <select id="file_list" size="6" name="filename" multiple="multiple">
 </select>

  <script>
  data_files = <?php 
getfiles($db, $files_array);
?>
 
  //console.log(data_files);

  for ( var i = 0; i < data_files.length; i++ ){
             $('#file_list').append($("<option/>", {
              value:data_files[i].file_id + "|" + data_files[i].filename + "|" + data_files[i].desc,
              text: data_files[i].file_id + "|" + data_files[i].filename + "|" + data_files[i].desc
             }));
     }

  </script>


<select name="vis"> 
开发者ID:anukiransolur,项目名称:intern_matryoshka,代码行数:31,代码来源:index.php


示例19: getfiles

<?php

/*
 
 Написать функцию, которая выводит список файлов в заданной директории. 
 Директория задается как параметр функции.
*/
function getfiles($dir)
{
    $files = scandir($dir);
    foreach ($files as $file) {
        echo $file . '<br>';
    }
}
getfiles('dir/');
开发者ID:gorbuz9kin,项目名称:Homework,代码行数:15,代码来源:index.php


示例20: get_image

function get_image($path)
{
    $img = "";
    $files = getfiles($path);
    for ($i = 0; $i < count($files); $i++) {
        if (stripos($files[$i], "jpg") || stripos($files[$i], "gif") || stripos($files[$i], "png")) {
            $img = $files[$i];
        }
    }
    return "/" . $path . $img;
}
开发者ID:pioytazsko,项目名称:drell,代码行数:11,代码来源:_bfunctions.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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