표준 PHP 라이브러리(SPL) RecursiveDirectoryIterator::getSubPathname

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

RecursiveDirectoryIterator::getSubPathname — 하위 경로 및 이름 가져오기


설명

public RecursiveDirectoryIterator::getSubPathname(): string

하위 경로와 파일 이름을 가져옵니다.


매개변수

이 함수에는 매개변수가 없습니다.


반환 값

하위 경로(하위 디렉토리) 및 파일 이름.


Examples

예제 #1 getSubPathname() 예제

                  
$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

                

기타