php教程

DirectoryIterator::next

(PHP 5, PHP 7)

DirectoryIterator::nextMove forward to next DirectoryIterator item

说明

public DirectoryIterator::next ( void ) : void

Move forward to the next DirectoryIterator item.

参数

此函数没有参数。

返回值

没有返回值。

范例

Example #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

参见

User Contributed Notes

There are no user contributed notes for this page.

CopyRight © 2008-2022 verySource.Com All Rights reserved. 京ICP备17048824号-1 京公网安备:11010502034788