closedir 함수

(PHP 4, PHP 5, PHP 7, PHP 8)

Closedir - 디렉토리 핸들 닫기


설명

closedir(?resource $dir_handle = null): void

dir_handle로 표시된 디렉토리 스트림을 닫습니다. 스트림은 이전에 opendir()에 의해 열려 있어야 합니다.


매개변수

dir_handle
이전에 opendir()로 열린 디렉토리 핸들 리소스입니다. 디렉토리 핸들이 지정되지 않으면 opendir()에 의해 열린 마지막 링크가 가정됩니다.

반환 값

값이 반환되지 않습니다.


Examples

예제 #1 closedir() 예제

                  
<?php
$dir = "/etc/php5/";

// Open a known directory, read directory into variable and then close
if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        $directory = readdir($dh);
        closedir($dh);
    }
}
?>