當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。