(PHP 4, PHP 5, PHP 7)
is_dir — Tells whether the filename is a directory
$filename
)Tells whether the given filename is a directory.
filename
Path to the file. If filename
is a relative
filename, it will be checked relative to the current working
directory. If filename
is a symbolic or hard link
then the link will be resolved and checked. If you have enabled 안전 모드,
or open_basedir further
restrictions may apply.
Returns TRUE
if the filename exists and is a directory, FALSE
otherwise.
Example #1 is_dir() example
<?php
var_dump(is_dir('a_file.txt'));
var_dump(is_dir('bogus_dir/abc'));
var_dump(is_dir('..')); //one dir up
?>
위 예제의 출력:
bool(false) bool(false) bool(true)
실패 시, E_WARNING
이 발생합니다.
Note: 이 함수의 결과는 캐시에 저장합니다. 자세한 설명은 clearstatcache()를 참고하십시오.
PHP 5.0.0부터 이 함수는 몇몇 URL 래퍼를 사용할 수 있습니다. 기능적으로 stat() 패밀리를 지원하는 래퍼 목록은 Supported Protocols and Wrappers를 참고하십시오.