RecursiveDirectoryIterator::getSubPath

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

RecursiveDirectoryIterator::getSubPathGet sub path

Beschreibung

public RecursiveDirectoryIterator::getSubPath(): string

Returns the sub path relative to the directory given in the constructor.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

The sub path.

Beispiele

Beispiel #1 getSubPath() example

$directory = '/tmp';

$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory));

foreach ($it as $file) {
echo 'SubPathName: ' . $it->getSubPathName() . "\n";
echo 'SubPath: ' . $it->getSubPath() . "\n\n";
}

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

SubPathName: fruit/apple.xml
     SubPath:     fruit
     
     SubPathName: stuff.xml
     SubPath:     
     
     SubPathName: veggies/carrot.xml
     SubPath:     veggies

Siehe auch

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top