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


PHP DirectoryIterator::rewind方法代码示例

本文整理汇总了PHP中DirectoryIterator::rewind方法的典型用法代码示例。如果您正苦于以下问题:PHP DirectoryIterator::rewind方法的具体用法?PHP DirectoryIterator::rewind怎么用?PHP DirectoryIterator::rewind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DirectoryIterator的用法示例。


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

示例1: rewind

 /**
  */
 public function rewind()
 {
     parent::rewind();
     while ($this->isDot()) {
         $this->next();
     }
 }
开发者ID:onedaylabs,项目名称:onedaylabs.com,代码行数:9,代码来源:FilesystemIterator.php

示例2: rewind

 /**
  * Rewinds the cache entry iterator to the first element
  *
  * @return void
  * @api
  */
 public function rewind()
 {
     if ($this->cacheFilesIterator === null) {
         $this->cacheFilesIterator = new \DirectoryIterator($this->cacheDirectory);
     }
     $this->cacheFilesIterator->rewind();
     while (substr($this->cacheFilesIterator->getFilename(), 0, 1) === '.' && $this->cacheFilesIterator->valid()) {
         $this->cacheFilesIterator->next();
     }
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:16,代码来源:SimpleFileBackend.php

示例3: getAvailableLanguages

 /**
  * Returns the available languages for this documentation format
  *
  * @return array Array of string language codes
  * @api
  */
 public function getAvailableLanguages()
 {
     $languages = array();
     $languagesDirectoryIterator = new \DirectoryIterator($this->formatPath);
     $languagesDirectoryIterator->rewind();
     while ($languagesDirectoryIterator->valid()) {
         $filename = $languagesDirectoryIterator->getFilename();
         if ($filename[0] != '.' && $languagesDirectoryIterator->isDir()) {
             $language = $filename;
             $languages[] = $language;
         }
         $languagesDirectoryIterator->next();
     }
     return $languages;
 }
开发者ID:nxpthx,项目名称:FLOW3,代码行数:21,代码来源:Format.php

示例4: getDocumentationFormats

 /**
  * Returns the available documentation formats for this documentation
  *
  * @return array Array of \TYPO3\Flow\Package\DocumentationFormat
  * @api
  */
 public function getDocumentationFormats()
 {
     $documentationFormats = array();
     $documentationFormatsDirectoryIterator = new \DirectoryIterator($this->documentationPath);
     $documentationFormatsDirectoryIterator->rewind();
     while ($documentationFormatsDirectoryIterator->valid()) {
         $filename = $documentationFormatsDirectoryIterator->getFilename();
         if ($filename[0] != '.' && $documentationFormatsDirectoryIterator->isDir()) {
             $documentationFormat = new \TYPO3\Flow\Package\Documentation\Format($filename, $this->documentationPath . $filename . '/');
             $documentationFormats[$filename] = $documentationFormat;
         }
         $documentationFormatsDirectoryIterator->next();
     }
     return $documentationFormats;
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:21,代码来源:Documentation.php

示例5: delete

 public static function delete($dir)
 {
     $dir = new DirectoryIterator($dir);
     foreach ($dir as $file) {
         if ($file->isDot()) {
             continue;
         } else {
             if ($file->isDir()) {
                 self::delete($file->getRealPath());
             } else {
                 if ($file->isFile()) {
                     unlink($file->getRealPath());
                 }
             }
         }
     }
     $dir->rewind();
     rmdir($dir->getRealPath());
 }
开发者ID:bklein01,项目名称:SiberianCMS,代码行数:19,代码来源:Directory.php

示例6: scanRecursiveDir

 /**
  * scan folders recursive and returns all folders
  * @param string $directory
  * @param string exclude
  * @return array|string
  */
 public function scanRecursiveDir($directory, $exclude = '')
 {
     try {
         $file = '';
         $it = new DirectoryIterator($directory);
         for ($it->rewind(); $it->valid(); $it->next()) {
             if ($it->isDir() && !$it->isDot()) {
                 if ($it->getFilename() == $exclude) {
                     continue;
                 }
                 $file[] = $it->getFilename();
             }
         }
         return $file;
     } catch (Exception $e) {
         $logger = new debug_logger(MP_LOG_DIR);
         $logger->log('error', 'php', 'An error has occured : ' . $e->getMessage(), debug_logger::LOG_VOID);
     }
 }
开发者ID:magix-cms,项目名称:magixcms-3,代码行数:25,代码来源:finder.php

示例7: getPackageDocumentations

 /**
  * Returns the available documentations for this package
  *
  * @return array Array of \TYPO3\Flow\Package\Documentation
  * @api
  */
 public function getPackageDocumentations()
 {
     $documentations = array();
     $documentationPath = $this->getDocumentationPath();
     if (is_dir($documentationPath)) {
         $documentationsDirectoryIterator = new \DirectoryIterator($documentationPath);
         $documentationsDirectoryIterator->rewind();
         while ($documentationsDirectoryIterator->valid()) {
             $filename = $documentationsDirectoryIterator->getFilename();
             if ($filename[0] != '.' && $documentationsDirectoryIterator->isDir()) {
                 $filename = $documentationsDirectoryIterator->getFilename();
                 $documentation = new Documentation($this, $filename, $documentationPath . $filename . '/');
                 $documentations[$filename] = $documentation;
             }
             $documentationsDirectoryIterator->next();
         }
     }
     return $documentations;
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:25,代码来源:Package.php

示例8: rewind

 function rewind()
 {
     echo __METHOD__ . "\n";
     parent::rewind();
 }
开发者ID:gleamingthecube,项目名称:php,代码行数:5,代码来源:ext_phar_tests_phar_oo_004U.php

示例9: rewind

 public function rewind()
 {
     parent::rewind();
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:4,代码来源:class.ilSetup.php

示例10: rewind

 /**
  * ( excerpt from http://php.net/manual/en/filesystemiterator.rewind.php )
  *
  * Rewinds the directory back to the start.
  *
  * @return     mixed   No value is returned.
  */
 public function rewind()
 {
     parent::rewind();
     $this->goPastDotsIfNeeded();
 }
开发者ID:badlamer,项目名称:hhvm,代码行数:12,代码来源:FilesystemIterator.php

示例11:

          echo '<tr><td>isWritable()</td><td> '; var_dump($item->isWritable()); echo '</td></tr>';
          echo '<tr><td>isReadable()</td><td> '; var_dump($item->isReadable()); echo '</td></tr>';
          echo '<tr><td>isExecutable(</td><td> '; var_dump($item->isExecutable()); echo '</td></tr>';
          echo '<tr><td>isFile()</td><td> '; var_dump($item->isFile()); echo '</td></tr>';
          echo '<tr><td>isDir()</td><td> '; var_dump($item->isDir()); echo '</td></tr>';
          echo '<tr><td>isLink()</td><td> '; var_dump($item->isLink()); echo '</td></tr>';
          echo '<tr><td>getFileInfo()</td><td> '; var_dump($item->getFileInfo()); echo '</td></tr>';
          echo '<tr><td>getPathInfo()</td><td> '; var_dump($item->getPathInfo()); echo '</td></tr>';
          echo '<tr><td>openFile()</td><td> '; var_dump($item->openFile()); echo '</td></tr>';
          echo '<tr><td>setFileClass()</td><td> '; var_dump($item->setFileClass()); echo '</td></tr>';
          echo '<tr><td>setInfoClass()</td><td> '; var_dump($item->setInfoClass()); echo '</td></tr>';*/
    }
}
echo '</table>';
// while 循环
$directoryIt->rewind();
while ($directoryIt->valid()) {
    // 过滤 . 和 ..
    if (!$directoryIt->isDot()) {
        echo $directoryIt->key(), '=>', $directoryIt->current(), '<br />';
    }
    $directoryIt->next();
}
// 获得该目录的所有文件和下级文件夹的文件
/*$rdIt = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('/data/www/yii2/learn/backend'));
foreach ($rdIt AS $name => $object) {
    echo $object.'<br/>';
}*/
echo '----------------------------------- DirectoryIterator END ---------------------------------', '<br />';
echo '--------------------------------- SimpleXMLIterator START-----------------------------------', '<br />';
/**
开发者ID:ray0916,项目名称:learn,代码行数:31,代码来源:iterator.php

示例12: seek

$di->seek(2);
$n = 0;
while ($di->valid()) {
    $n++;
    $di->next();
}
echo "With seek(2) we get {$n}\n";
$di->seek(0);
$m = 0;
while ($di->valid()) {
    $m++;
    $di->next();
}
echo "With seek(0) we get {$m}\n";
$o = 0;
$di->rewind();
while ($di->valid()) {
    $o++;
    $di->next();
}
echo "Without seek we get {$o}\n";
$p = 0;
$di->seek($o + 1);
while ($di->valid()) {
    $p++;
    $di->next();
}
var_dump($n !== $m, $m === $o, $p === 0);
?>
===DONE===
开发者ID:clifton98,项目名称:hhvm,代码行数:30,代码来源:dit_006.php

示例13: rewind

 /**
  * Rewind the Iterator to the first resource.
  */
 public function rewind()
 {
     $this->iterator->rewind();
 }
开发者ID:mohiva,项目名称:common,代码行数:7,代码来源:FilesystemResourceContainer.php

示例14: getDocumentationFormats

 /**
  * Returns the available documentation formats for this documentation
  *
  * @return array Array of \F3\FLOW3\Package\DocumentationFormat
  * @author Christopher Hlubek <hlubek@networkteam.com>
  * @api
  */
 public function getDocumentationFormats()
 {
     $documentationFormats = array();
     $documentationFormatsDirectoryIterator = new \DirectoryIterator($this->documentationPath);
     $documentationFormatsDirectoryIterator->rewind();
     while ($documentationFormatsDirectoryIterator->valid()) {
         $filename = $documentationFormatsDirectoryIterator->getFilename();
         if ($filename[0] != '.' && $documentationFormatsDirectoryIterator->isDir()) {
             $documentationFormat = $this->objectFactory->create('F3\\FLOW3\\Package\\Documentation\\Format', $filename, $this->documentationPath . $filename . '/');
             $documentationFormats[$filename] = $documentationFormat;
         }
         $documentationFormatsDirectoryIterator->next();
     }
     return $documentationFormats;
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:22,代码来源:Documentation.php

示例15: substr

$request = substr($_SERVER['REDIRECT_URL'],strlen($_SERVER['PHP_SELF'])-9);

define('NUM_PER_PAGE',3);

//need to sanatize
preg_match("#page/([0-9]+)#",$request,$matches);
$page = (int)$matches[1];
preg_match("#photo/([0-9A-Za-z-]+)#",$request,$matches);
$requestedPhoto = $matches[1];


$photos = new DirectoryIterator('./photos');


$fileNames = $currentPageFiles = array();
$photos->rewind();
foreach($photos as $photo) {
	if(!$photo->isDot() && $photo->isFile()) {
		$numFiles++;
		$fileNames[] = $photo->getFilename();
	}
}

$numPages = ceil($numFiles/NUM_PER_PAGE);

if($requestedPhoto && in_array($requestedPhoto.'.jpg',$fileNames)) {
	$exif = exif_read_data('./photos/'.$requestedPhoto.'.jpg');
	$currentPhoto = $exif;
	$currentPhoto['webHref'] = '/source/chapter7/browser/photos/'.$requestedPhoto.'.jpg';
	$currentPage = ceil((array_search($requestedPhoto.'.jpg',$fileNames)+1)/NUM_PER_PAGE);
	$currentPageFiles = array_slice($fileNames,NUM_PER_PAGE*($currentPage-1),NUM_PER_PAGE);
开发者ID:syang7,项目名称:foED-AdvancED-DOM-Scripting,代码行数:31,代码来源:index.php


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