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


PHP openDir函数代码示例

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


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

示例1: loadDir

function loadDir($dirName)
{
    if ($handle = openDir($dirName)) {
        echo "<tr class='trTitle'><td>类型</td><td>文件名</td><td>大小</td><td>最后修改时间</td><td>操作</td></tr>";
        while (false !== ($files = readDir($handle))) {
            if ($files != "." && $files != "..") {
                $urlStrs = $dirName . "/" . $files;
                if (!is_dir($dirName . "/" . $files)) {
                    $types = "文件";
                    $cons = "<a href=\"loaddir.php?action=edit&urlstr={$urlStrs}\">编辑</a>";
                    $className = "file";
                    $fileSize = getSize($dirName . "/" . $files);
                    $fileaTime = date("Y-m-d H:i:s", getEditTime($dirName . "/" . $files));
                    $arrayfile[] = "<tr class='{$className}'><td>{$types}</td><td>{$files}</td><td>" . $fileSize . " bytes</td><td>{$fileaTime}</td><td>{$cons}</td></tr>";
                }
                //echo "<tr class='$className'><td>$types</td><td>$files</td><td>".$fileSize." bytes</td><td>$fileaTime</td><td>$cons</td></tr>";
            }
        }
        //$arraydirLen=count($arraydir);
        //for($i=0;$i<$arraydirLen;$i++) echo $arraydir[$i];
        $arrayfileLen = count($arrayfile);
        for ($i = 0; $i < $arrayfileLen; $i++) {
            echo $arrayfile[$i];
        }
        //echo $arraydir;
        closeDir($handle);
    }
}
开发者ID:jyyy410team,项目名称:hts,代码行数:28,代码来源:loaddir-old.php

示例2: load

 public function load()
 {
     $this->headline = $GLOBALS['language']->getString("FILES");
     if (!isset($_GET['dir']) || substr($_GET['dir'], 0, 1) == '.') {
         $_GET['dir'] = "";
     }
     $uploadpath = Settings::getInstance()->get("root") . "content/uploads/";
     $this->template = new Template();
     $this->template->load("plugin_filelistwidget_filelist");
     $this->template->show_if("FILES_EXIST", false);
     $this->template->show_if("NOFILES", false);
     $this->template->assign_var("DIR", htmlentities($_GET['dir']));
     $actions = ActionList::get("plugin_filelistwidget");
     $dir = $_GET['dir'];
     if (file_exists($uploadpath . $dir)) {
         $this->delete($uploadpath);
         $this->rename($dir, $uploadpath);
         $verzeichnis = openDir($uploadpath . $dir);
         $pre = "";
         $path = "";
         foreach (explode("/", $dir) as $cDir) {
             $index = $this->template->add_loop_item("PATH");
             $path .= "/" . $cDir;
             if ($path == "/") {
                 $this->template->assign_loop_var("PATH", $index, "URL", "/admin/index.php?page=files");
                 $this->template->assign_loop_var("PATH", $index, "LABEL", "/");
                 $path = "";
             } else {
                 $this->template->assign_loop_var("PATH", $index, "URL", "/admin/index.php?page=files&dir=" . $path);
                 $this->template->assign_loop_var("PATH", $index, "LABEL", $cDir);
             }
         }
         if (trim($_GET['dir']) != "" & trim($_GET['dir']) != "/") {
             $this->template->assign_var("DELETEFOLDERLINK", "<a href=\"/admin/index.php?page=files&rmdir=" . $_GET['dir'] . "\">Ordner l&ouml;schen</a>");
         } else {
             $this->template->assign_var("DELETEFOLDERLINK", "");
         }
         $files = FileServer::getFiles($uploadpath . $dir);
     }
     if (isset($files) && sizeOf($files) > 0) {
         $this->template->show_if("FILES_EXIST", true);
         $this->template->show_if("NOFILES", false);
         foreach ($files as $file) {
             $index = $this->template->add_loop_item("FILES");
             $this->template->assign_loop_var("FILES", $index, "IMAGE", $this->getImageCode($uploadpath, $dir, $file));
             $this->template->assign_loop_var("FILES", $index, "FILELINK", "<a href=\"../content/uploads" . $dir . "/" . $file . "\">" . $file . "</a>");
             $params = array();
             $params['dir'] = $_GET['dir'];
             $params['file'] = $file;
             $this->template->assign_loop_var("FILES", $index, "ACTIONS", $actions->getCode($params));
         }
     } else {
         $this->template->show_if("FILES_EXIST", false);
         $this->template->show_if("NOFILES", true);
     }
     $this->template->assign_var("MESSAGE", "");
     $this->content = $this->template->getCode();
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:58,代码来源:filelistwidget.php

示例3: loadAll

 public function loadAll()
 {
     $pluginpath = Settings::getInstance()->get("root") . "system/plugins";
     $oDir = openDir($pluginpath);
     while ($item = readDir($oDir)) {
         $this->AddInfo($item);
     }
     closeDir($oDir);
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:9,代码来源:pluginlist.php

示例4: get_teaser_array

/**
 * This function returns a list of teaser - images contained in the $teaser - directory
 */
function get_teaser_array($teaser_directory)
{
    $teaser_array = array();
    $directory = openDir($teaser_directory);
    while ($file = readDir($directory)) {
        if ($file != "." && $file != "..") {
            array_push($teaser_array, $teaser_directory . $file);
        }
    }
    closeDir($directory);
    return $teaser_array;
}
开发者ID:sleekshop,项目名称:demoshop,代码行数:15,代码来源:teaser.inc.php

示例5: getFiles

function getFiles()
{
    //get list of all files for use in other routines
    global $dirPtr, $theFiles;
    chdir(".");
    $dirPtr = openDir(".");
    $currentFile = readDir($dirPtr);
    while ($currentFile !== false) {
        $theFiles[] = $currentFile;
        $currentFile = readDir($dirPtr);
    }
    // end while
}
开发者ID:ashutoshdev,项目名称:phptutorials-1,代码行数:13,代码来源:QuizMachine.php

示例6: get_filelist

 private function get_filelist()
 {
     $filelist = array();
     $contentfolderpath = 'content/';
     $contentfolder = openDir($contentfolderpath);
     while ($file = readDir($contentfolder)) {
         if ($file != "." && $file != ".." && !is_dir($contentfolderpath . "/" . $file)) {
             $pathparts = pathinfo($file);
             $filelist[$pathparts['filename']] = $file;
         }
     }
     closeDir($contentfolder);
     return $filelist;
 }
开发者ID:Drakenson,项目名称:DrakeWork,代码行数:14,代码来源:worker.class.php

示例7: getFolders

 /**
  *
  * @param string $dir
  * @return array
  */
 public static function getFolders($dir)
 {
     $res = array();
     $oDir = openDir($dir);
     while ($item = readDir($oDir)) {
         if (is_dir($dir . "/" . $item)) {
             if ($item != "." && $item != "..") {
                 $res[] = $item;
             }
         }
     }
     closeDir($oDir);
     return $res;
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:19,代码来源:fileserver.php

示例8: copyFiles

 /**
  * Copies all files from one directory to another directory.
  * @param string $sourceDirectory The source directory.
  * @param string $targetDirectory The target directory.
  */
 public function copyFiles($sourceDirectory, $targetDirectory)
 {
     $dir = openDir($sourceDirectory);
     @mkDir($targetDirectory);
     while (false !== ($file = readDir($dir))) {
         if ($file == '.' || $file == '..') {
             continue;
         }
         if (is_dir($sourceDirectory . '/' . $file)) {
             $this->copyFiles($sourceDirectory . '/' . $file, $targetDirectory . '/' . $file);
         } else {
             copy($sourceDirectory . '/' . $file, $targetDirectory . '/' . $file);
         }
     }
     closeDir($dir);
 }
开发者ID:rutgerkok,项目名称:rCMS,代码行数:21,代码来源:BulkFileSystem.php

示例9: __construct

 /**
  * @param string $configDir
  */
 public function __construct($configDir)
 {
     $yml = new Parser();
     $configFilesPath = [];
     if (is_dir($configDir)) {
         $dirHandler = openDir($configDir);
         while ($data = readdir($dirHandler)) {
             $configFilesPath[] = $data;
         }
         $configFilesPath = array_diff($configFilesPath, ['.', '..']);
         closedir();
     }
     $config = [];
     foreach ($configFilesPath as $configFilePath) {
         $config[$configFilePath] = $yml->parse(file_get_contents($configDir . '/' . $configFilePath));
     }
     $this->config = $config;
 }
开发者ID:valous,项目名称:captcha,代码行数:21,代码来源:Config.php

示例10: loadClassPath

 /**
  * Метод рекурсивно собирает все классы в директории.
  * 
  * @param string $dirAbsPath - путь к директории
  * @param array $classes - карта [PsUtil] => [C:/www/postupayu.ru/www/kitcore/utils/PsUtil.php]
  * @param bool $skipDirClasses - пропускать ли классы в корневой директории.
  * Флаг позволит не подключать классы, лежащие в корне kitcore,
  * так как их мы подключим сами (Globals, Defines, PsCoreIncluder)
  */
 public static function loadClassPath($dirAbsPath, array &$classes, $skipDirClasses)
 {
     if (!is_dir($dirAbsPath)) {
         return;
         //---
     }
     $dir = openDir($dirAbsPath);
     while ($file = readdir($dir)) {
         if (!is_valid_file_name($file)) {
             continue;
         }
         $isphp = ends_with($file, '.php');
         if ($isphp && $skipDirClasses) {
             continue;
         }
         $path = next_level_dir($dirAbsPath, $file);
         if ($isphp) {
             $classes[cut_string_end($file, '.php')] = $path;
         } else {
             self::loadClassPath($path, $classes, false);
         }
     }
     closedir($dir);
 }
开发者ID:ilivanoff,项目名称:www,代码行数:33,代码来源:PsCoreIncluder.php

示例11: array

$zaehler = 0;
$zeit = 0;
//Arrays für ansprechende Zeitausgabe
$monate = array("Januar", "Februar", "M&auml;rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember");
$tage = array("Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag");
//Nun die Routine, um Dateien aus einem Verzeichnis auszulesen:
//Erstes Verzeichnis wird geöffnet:
$topdir = openDir("../graph");
//Jede Datei in erstem Verzeichnis ausgelesen:
while ($topfile = readDir($topdir)) {
    //Überprüfung, ob die Datei kein versteckter Ordner ist, wenn nicht wird ein Titel geschrieben
    if (substr($topfile, 0, 1) != ".") {
        echo "<div class=\"titel\"><h1>{$topfile}</h1></div>";
        echo "<div class=\"liste\">";
        //Gefundenes Kategorienverzeichnis wird geöffnet und nun nach Bildern durchsucht. JS-Links werden generiert.
        $categorydir = openDir("../graph/{$topfile}");
        while ($file = readDir($categorydir)) {
            if (substr($file, 0, 1) != ".") {
                echo "<a href='javascript:anzeigen(\"../graph/{$topfile}/{$file}\")' id=\"{$zaehler}\">{$file}</a><br>\n";
                $zaehler = $zaehler + 1;
                //Datei mit der Höchsten änderungszeit wird gesucht
                if (filemtime("../graph/{$topfile}/{$file}") > $zeit) {
                    $zeit = fileatime("../graph/{$topfile}/{$file}");
                }
            }
        }
        //Zeiten werden formatiert
        $zeit_monat = $monate[date("n", $zeit) - 1];
        $zeit_tag = $tage[date("N", $zeit) - 1];
        $zeit_datum = date("d.", $zeit);
        $zeit_uhrzeit = date("H:i:s", $zeit);
开发者ID:jogi91,项目名称:purepo,代码行数:31,代码来源:index.php

示例12: getCover

 /**
 * Title
 *
 * Description
 *
 * @access public
 */
  function getCover($path) {
   $common_covers=array('cover.jpg');
   foreach($common_covers as $file) {
    if (file_exists($path.$file)) {
     return $file;
    }
   }

   //search for images
  @$d=openDir($path);
  if ($d) {
   $files=array();
   $biggest_size=0;
   $biggest_file='';
   while ($file=readDir($d)) {
   if (preg_match('/\.jpg$/is', $file) 
      || preg_match('/\.jpeg$/is', $file) 
      || preg_match('/\.gif$/is', $file)
      || preg_match('/\.png$/is', $file)
   ) {
    $file_size=filesize($path.$file);
    if ($file_size>$biggest_size) {
     $biggest_size=$file_size;
     $biggest_file=$file;
    }
    //$files=array('FILENAME'=>$file);
   }
   }
   closeDir($d);
   if ($biggest_file) {
    return $biggest_file;
   }
  }



  }
开发者ID:novozhenets,项目名称:majordomo,代码行数:44,代码来源:app_mediabrowser.class.php

示例13: poidsDossier

 public static function poidsDossier($dossier)
 {
     $dir = openDir($dossier);
     $poids = 0;
     while ($f = readdir($dir)) {
         if ($f != '.' && $f != '..') {
             if (is_dir($dossier . $f)) {
                 $poids += poidsDossier($dossier . $f . '/');
             } else {
                 $poids += filesize($dossier . $f);
             }
         }
     }
     return $poids;
 }
开发者ID:Elrenardo,项目名称:FoxFWcms-4,代码行数:15,代码来源:FoxFWFile.php

示例14: getSubDirNames

 /**
  * Получает названия папок, вложенных в переданную директорию
  * 
  * @param array $allowed - список допустимых названий подпапок
  */
 public final function getSubDirNames($dirs = null, $allowed = null, $denied = null)
 {
     $result = array();
     $allowed = $allowed === null ? null : to_array($allowed);
     if (is_array($allowed) && empty($allowed)) {
         return $result;
     }
     $denied = $denied === null ? null : to_array($denied);
     $absDirPath = $this->absDirPath($dirs);
     if (is_dir($absDirPath)) {
         $dir = openDir($absDirPath);
         if ($dir) {
             $absDirPath = ensure_dir_endswith_dir_separator($absDirPath);
             while ($file = readdir($dir)) {
                 if (!is_valid_file_name($file)) {
                     continue;
                 }
                 if (is_array($allowed) && !in_array($file, $allowed)) {
                     continue;
                 }
                 if (is_array($denied) && in_array($file, $denied)) {
                     continue;
                 }
                 if (is_dir($absDirPath . $file)) {
                     $result[] = $file;
                 }
             }
             closedir($dir);
         }
     }
     return $result;
 }
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:37,代码来源:DirManager.php

示例15: getNotYetInstalledPlugins

 function getNotYetInstalledPlugins()
 {
     $col = array();
     $paths = array($this->_getCustomPluginsRoot(), $this->_getOfficialPluginsRoot());
     $exclude = array('.', '..', 'CVS', '.svn');
     foreach ($paths as $path) {
         $dir = openDir($path);
         while ($file = readDir($dir)) {
             if (!in_array($file, $exclude) && is_dir($path . '/' . $file)) {
                 if (!$this->isPluginInstalled($file) && !in_array($file, $col)) {
                     $col[] = $file;
                 }
             }
         }
         closeDir($dir);
     }
     return $col;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:18,代码来源:PluginFactory.class.php


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