DirectoryIterator::rewind

(PHP 5, PHP 7, PHP 8)

DirectoryIterator::rewindRewind the DirectoryIterator back to the start

說(shuō)明

public DirectoryIterator::rewind(): void

Rewind the DirectoryIterator back to the start.

參數(shù)

此函數(shù)沒(méi)有參數(shù)。

返回值

沒(méi)有返回值。

范例

示例 #1 DirectoryIterator::rewind() example

<?php
$iterator 
= new DirectoryIterator(dirname(__FILE__));

$iterator->next();
echo 
$iterator->key(); //1

$iterator->rewind(); //rewinding to the beginning
echo $iterator->key(); //0
?>

參見(jiàn)