표준 PHP 라이브러리(SPL) DirectoryIterator::getPathname

(PHP 5, PHP 7, PHP 8)

DirectoryIterator::getPathname — 현재 DirectoryIterator 항목의 경로 및 파일 이름 반환


설명

public DirectoryIterator::getPathname(): string

현재 파일의 경로와 파일 이름을 가져옵니다.


매개변수

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


반환 값

현재 파일의 경로와 파일 이름을 반환합니다. 디렉토리에는 슬래시가 없습니다.


Examples

예제 #1 DirectoryIterator::getPathname() 예제

                  
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
foreach ($iterator as $fileinfo) {
    echo $fileinfo->getPathname() . "\n";
}
?>
                  
                

위의 예는 다음과 유사한 결과를 출력합니다.

/home/examples/.
/home/examples/..
/home/examples/apple.jpg
/home/examples/banana.jpg
/home/examples/getpathname.php
/home/examples/pear.jpg
                

기타