(PHP 5 >= 5.1.0, PHP 7, PHP 8)
RecursiveDirectoryIterator::getSubPath — 取得子路徑
此函式沒有參數。
子路徑。
範例 #1 getSubPath() 範例
$directory = '/tmp';
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory));
foreach ($it as $file) {
echo 'SubPathName: ' . $it->getSubPathName() . "\n";
echo 'SubPath: ' . $it->getSubPath() . "\n\n";
}
以上範例將輸出類似以下的內容
SubPathName: fruit/apple.xml SubPath: fruit SubPathName: stuff.xml SubPath: SubPathName: veggies/carrot.xml SubPath: veggies