PHP 8.1.28 Released!

RecursiveDirectoryIterator::getSubPath

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

RecursiveDirectoryIterator::getSubPathObtiene sub ruta

Descripción

public RecursiveDirectoryIterator::getSubPath(): string

Devuelve el sub ruta relativo al directorio dado en el constructor.

Parámetros

Esta función no tiene parámetros.

Valores devueltos

La sub ruta.

Ejemplos

Ejemplo #1 Ejemplo de getSubPath()

$directory = '/tmp';

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

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

El resultado del ejemplo sería algo similar a:

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

Ver también

add a note

User Contributed Notes

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