(PHP 5 >= 5.1.0, PHP 7, PHP 8)
RecursiveDirectoryIterator::getSubPath — Obtiene sub ruta
Devuelve el sub ruta relativo al directorio dado en el constructor.
Esta función no tiene parámetros.
La sub ruta.
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