mime_content_type
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
mime_content_type — 파일에 대한 MIME 콘텐츠 유형 감지
설명
mime_content_type(resource|string $filename
): string|false
magic.mime 파일의 정보를 사용하여 결정된 파일의 MIME 콘텐츠 유형을 반환합니다.
매개변수
filename
- 테스트된 파일의 경로입니다.
반환 값
text/plain 또는 application/octet-stream과 같은 MIME 형식의 콘텐츠 유형을 반환하거나 실패 시 false
를 반환합니다.
오류/예외
실패 시 E_WARNING
이 발생합니다.
Examples
예제 #1 mime_content_type() 예제
<?php
echo mime_content_type('php.gif') . "\n";
echo mime_content_type('test.php');
?>
위의 예는 다음을 출력합니다.
image/gif text/plain
기타
- finfo_file() - finfo_file()의 별칭
- finfo_buffer() - finfo_buffer()의 별칭