array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'recursivedirectoryiterator.getsubpath.php', 1 => 'RecursiveDirectoryIterator::getSubPath', ), 'up' => array ( 0 => 'class.recursivedirectoryiterator.php', 1 => 'RecursiveDirectoryIterator', ), 'prev' => array ( 0 => 'recursivedirectoryiterator.getchildren.php', 1 => 'RecursiveDirectoryIterator::getChildren', ), 'next' => array ( 0 => 'recursivedirectoryiterator.getsubpathname.php', 1 => 'RecursiveDirectoryIterator::getSubPathname', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'pt_BR', 'path' => 'reference/spl/recursivedirectoryiterator/getsubpath.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
RecursiveDirectoryIterator::getSubPath — Obtém o subcaminho
Retorna o subcaminho relativo ao diretório fornecido no construtor.
Esta função não possui parâmetros.
O subcaminho.
Exemplo #1 Exemplo 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";
}
O exemplo acima produzirá algo semelhante a:
SubPathName: fruit/apple.xml SubPath: fruit SubPathName: stuff.xml SubPath: SubPathName: veggies/carrot.xml SubPath: veggies