PHP 8.5.0 Alpha 2 available for testing

RecursiveDirectoryIterator::getSubPath

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

RecursiveDirectoryIterator::getSubPathObtiene el subcamino

Descripción

public RecursiveDirectoryIterator::getSubPath(): string

Devuelve el subcamino relativo al directorio especificado en el constructor.

Parámetros

Esta función no contiene ningún parámetro.

Valores devueltos

El subcamino.

Ejemplos

Ejemplo #1 Ejemplo getSubPath()

$directory = '/tmp';

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

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

Resultado del ejemplo anterior es 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