(PHP 4, PHP 5, PHP 7)
filetype — Gets file type
$filename
)Returns the type of the given file.
filename
Path to the file.
Returns the type of the file. Possible values are fifo, char, dir, block, link, file, socket and unknown.
Returns FALSE
if an error occurs. filetype() will also
produce an E_NOTICE
message if the stat call fails
or if the file type is unknown.
Example #1 filetype() example
<?php
echo filetype('/etc/passwd'); // file
echo filetype('/etc/'); // dir
?>
실패 시, E_WARNING
이 발생합니다.
Note: 이 함수의 결과는 캐시에 저장합니다. 자세한 설명은 clearstatcache()를 참고하십시오.
PHP 5.0.0부터 이 함수는 몇몇 URL 래퍼를 사용할 수 있습니다. 기능적으로 stat() 패밀리를 지원하는 래퍼 목록은 Supported Protocols and Wrappers를 참고하십시오.