# La classe DirectoryIterator

(PHP 5, PHP 7, PHP 8)

## Introduction

La classe DirectoryIterator fournit une interface simple pour lire le contenu d'un système de fichiers.

## Synopsis de la classe

class DirectoryIterator extends SplFileInfo implements SeekableIterator {
/* Méthodes */
public function __construct(string `$directory`)
public function current(): mixed
public function getBasename(string `$suffix` = ""): string
public function getExtension(): string
public function getFilename(): string
public function isDot(): bool
public function key(): mixed
public function next(): void
public function rewind(): void
public function seek(int `$offset`): void
public function __toString(): string
public function valid(): bool
/* Méthodes héritées */
public function SplFileInfo::getATime(): int|false
public function SplFileInfo::getBasename(string `$suffix` = ""): string
public function SplFileInfo::getCTime(): int|false
public function SplFileInfo::getExtension(): string
public function SplFileInfo::getFileInfo(?string `$class` = `null`): SplFileInfo
public function SplFileInfo::getFilename(): string
public function SplFileInfo::getGroup(): int|false
public function SplFileInfo::getInode(): int|false
public function SplFileInfo::getLinkTarget(): string|false
public function SplFileInfo::getMTime(): int|false
public function SplFileInfo::getOwner(): int|false
public function SplFileInfo::getPath(): string
public function SplFileInfo::getPathInfo(?string `$class` = `null`): ?SplFileInfo
public function SplFileInfo::getPathname(): string
public function SplFileInfo::getPerms(): int|false
public function SplFileInfo::getRealPath(): string|false
public function SplFileInfo::getSize(): int|false
public function SplFileInfo::getType(): string|false
public function SplFileInfo::isDir(): bool
public function SplFileInfo::isExecutable(): bool
public function SplFileInfo::isFile(): bool
public function SplFileInfo::isLink(): bool
public function SplFileInfo::isReadable(): bool
public function SplFileInfo::isWritable(): bool
public function SplFileInfo::openFile(string `$mode` = "r", bool `$useIncludePath` = `false`, ?resource `$context` = `null`): SplFileObject
public function SplFileInfo::setFileClass(string `$class` = `SplFileObject::class`): void
public function SplFileInfo::setInfoClass(string `$class` = `SplFileInfo::class`): void
public function SplFileInfo::__toString(): string
}

## Sommaire

- DirectoryIterator::__construct — Construit un nouvel itérateur de dossier à partir d'un chemin
- DirectoryIterator::current — Retourne l'élément courant du DirectoryIterator
- DirectoryIterator::getBasename — Lit le nom de base de l'élément DirectoryIterator
- DirectoryIterator::getExtension — Récupère l'extension du fichier
- DirectoryIterator::getFilename — Retourne le nom de l'entrée courante du dossier
- DirectoryIterator::isDot — Retourne true si l'entrée courante est '.' ou '..'
- DirectoryIterator::key — Retourne l'entrée courante du dossier
- DirectoryIterator::next — Se déplace vers la prochaine entrée
- DirectoryIterator::rewind — Revient au début du dossier
- DirectoryIterator::seek — Déplace le pointeur dans un itérateur DirectoryIterator
- DirectoryIterator::__toString — Lit le nom du fichier
- DirectoryIterator::valid — Vérifie si le répertoire contient encore des entrées

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open