本文整理汇总了PHP中RecursiveDirectoryIterator::rewind方法的典型用法代码示例。如果您正苦于以下问题:PHP RecursiveDirectoryIterator::rewind方法的具体用法?PHP RecursiveDirectoryIterator::rewind怎么用?PHP RecursiveDirectoryIterator::rewind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecursiveDirectoryIterator
的用法示例。
在下文中一共展示了RecursiveDirectoryIterator::rewind方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rewind
public function rewind()
{
if (false === $this->isRewindable()) {
return;
}
parent::next();
parent::rewind();
}
示例2: rewind
/**
* Do nothing for non rewindable stream
*/
public function rewind()
{
if (false === $this->isRewindable()) {
return;
}
// @see https://bugs.php.net/bug.php?id=49104
parent::next();
parent::rewind();
}
示例3: rewind
public function rewind()
{
if (false === $this->isRewindable()) {
return;
}
if (PHP_VERSION_ID < 50523 || PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50607) {
parent::next();
}
parent::rewind();
}
示例4: gettype
<?php
$it1 = new RecursiveDirectoryIterator(dirname(__FILE__), FileSystemIterator::CURRENT_AS_PATHNAME);
$it1->rewind();
echo gettype($it1->current()) . "\n";
$it2 = new RecursiveDirectoryIterator(dirname(__FILE__));
$it2->rewind();
echo gettype($it2->current()) . "\n";
示例5: addFolder
/**
* @inheritdoc
*/
public function addFolder($path, $parent = '')
{
/**
* @var \SplFileInfo $item
*/
if (file_exists($path)) {
$parent = $parent === null ? '' : $parent . DIRECTORY_SEPARATOR;
$innerPath = $parent . basename($path);
$dir = new \RecursiveDirectoryIterator($path);
$dir->rewind();
while ($dir->valid()) {
$item = $dir->current();
if ($item->isDir()) {
if (!in_array($item->getFilename(), array('.', '..'))) {
$this->addFolder($item->getRealPath(), $innerPath);
}
} else {
$this->addFile($item->getRealPath(), $innerPath . DIRECTORY_SEPARATOR . $item->getFilename(), true);
}
$dir->next();
}
}
return $this->updateArchive();
}
示例6: rewind
/**
* Do nothing for non rewindable stream.
*/
public function rewind()
{
if (false === $this->isRewindable()) {
return;
}
// @see https://bugs.php.net/68557
if (PHP_VERSION_ID < 50523 || PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50607) {
parent::next();
}
parent::rewind();
}
示例7: rewind
public function rewind()
{
parent::rewind();
// Skip current and parent directory
$this->skipdots();
}
示例8: rewind
function rewind()
{
echo __FUNCTION__ . "\n";
return parent::rewind();
}
示例9: _fetch
/**
*
* Recursively iterates through a directory looking for class files.
*
* Skips CVS directories, and all files and dirs not starting with
* a capital letter (such as dot-files).
*
* @param RecursiveDirectoryIterator $iter Directory iterator.
*
* @return void
*
*/
protected function _fetch(RecursiveDirectoryIterator $iter)
{
for ($iter->rewind(); $iter->valid(); $iter->next()) {
// preliminaries
$path = $iter->current()->getPathname();
$file = basename($path);
$capital = ctype_alpha($file[0]) && $file == ucfirst($file);
$phpfile = strripos($file, '.php');
// check for valid class files
if ($iter->isDot() || !$capital) {
// skip dot-files (including dot-file directories), as
// well as files/dirs not starting with a capital letter
continue;
} elseif ($iter->isDir() && $file == 'CVS') {
// skip CVS directories
continue;
} elseif ($iter->isDir() && $iter->hasChildren()) {
// descend into child directories
$this->_fetch($iter->getChildren());
} elseif ($iter->isFile() && $phpfile) {
// map the .php file to a class name
$len = strlen($this->_base);
$class = substr($path, $len, -4);
// drops .php
$class = str_replace(DIRECTORY_SEPARATOR, '_', $class);
$this->_map[$class] = $path;
}
}
}
示例10: resolve
/**
* @private
*
* 1. Mimics tmp directory
* 2. Find latest cache if $hash is null
* 3. Return directory if $hash is '*'
*/
private static function resolve($key, $hash = null)
{
$target = sys_get_temp_dir();
if (strrpos($target, DIRECTORY_SEPARATOR) !== strlen($target) - 1) {
$target .= DIRECTORY_SEPARATOR;
}
$target .= md5($key);
if (!file_exists($target)) {
if ($hash !== '*') {
return null;
} elseif (mkdir($target) === false) {
throw new FrameworkException('Error creating cache folder "' . $target . '", please check folder permissions.');
}
} else {
if (is_file($target)) {
throw new FrameworkException($target . ' is already a file, please specify another path.');
}
}
$target .= DIRECTORY_SEPARATOR;
if ($hash === '*') {
return new \RecursiveDirectoryIterator($target, \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS);
}
if ($hash !== null) {
$target = "{$target}{$hash}";
if (!is_file($target)) {
throw new FrameworkException('Target revision is not a file.');
}
return new \SplFileInfo($target);
} else {
$res = new \RecursiveDirectoryIterator($target, \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS);
$res->next();
$res->rewind();
$lfile = null;
foreach ($res as $file) {
if ($file->isFile() && strlen($file->getFilename()) == 32 && ($lfile == null || $lfile->getMTime() < $file->getMTime())) {
$lfile = $file;
}
}
if ($lfile === null) {
return null;
}
if (!$lfile->isReadable() || !$lfile->isWritable()) {
throw new FrameworkException('Cache cannot be read or written, please check file permission to PHP user.');
}
return $lfile;
}
}
示例11: array
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<!--стили сайта-->
<?php
Yii::app()->bootstrap->init();
$assets = Yii::app()->getModule('docs')->assetsUrl();
Yii::app()->clientScript->registerCssFile($assets . '/css/styles.css');
?>
</head>
<body>
<?php
$items = array();
$i = new RecursiveDirectoryIterator(Yii::getPathOfAlias('docs.views.documentation'));
for ($i->rewind(); $i->valid(); $i->next()) {
$item = $i->current();
if (!$i->hasChildren()) {
continue;
}
$folder_name = t($item->getFileName());
$active_folder = false;
$tmp = array();
foreach ($i->getChildren() as $child) {
list($file) = explode('.', $child->getFileName());
$active = isset($_GET['alias']) && $_GET['alias'] == $file ? true : false;
$active_folder = $active_folder || $active;
$tmp[] = array('label' => t($file), 'itemOptions' => array(), 'active' => $active, 'url' => Yii::app()->createUrl('/docs/documentation/index', array('alias' => $file, 'folder' => $item->getFileName())));
}
if ($active_folder) {
$items[] = array('label' => $folder_name, 'itemOptions' => array('class' => 'nav-header'));