PHP - Manual: DirectoryIterator::next
2024-12-21
(PHP 5, PHP 7, PHP 8)
DirectoryIterator::next — Move forward to next DirectoryIterator item
此函数没有参数。
没有返回值。
示例 #1 DirectoryIterator::next() example
List the contents of a directory using a while loop.
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
while($iterator->valid()) {
echo $iterator->getFilename() . "\n";
$iterator->next();
}
?>
以上例程的输出类似于:
. .. apple.jpg banana.jpg index.php pear.jpg
官方地址:https://www.php.net/manual/en/directoryiterator.next.php