update : 2015.11.03
php.shukuma.com

검색:
 
 
Return information about a file

finfo_file

finfo::file

(PHP >= 5.3.0, PECL fileinfo >= 0.1.0)

finfo_file -- finfo::fileReturn information about a file

설명

절차식 형식

string finfo_file ( resource $finfo , string $file_name = NULL [, int $options = FILEINFO_NONE [, resource $context = NULL ]] )

객체 기반 형식

public string finfo::file ( string $file_name = NULL [, int $options = FILEINFO_NONE [, resource $context = NULL ]] )

This function is used to get information about a file.

인수

finfo

Fileinfo resource returned by finfo_open().

file_name

Name of a file to be checked.

options

One or disjunction of more Fileinfo constants.

context

For a description of contexts, refer to Stream 함수 목록.

반환값

Returns a textual description of the contents of the file_name argument, or FALSE if an error occurred.

예제

Example #1 A finfo_file() example

<?php
$finfo 
finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
foreach (glob("*") as $filename) {
    echo 
finfo_file($finfo$filename) . "\n";
}
finfo_close($finfo);
?>

위 예제의 출력 예시:

text/html
image/gif
application/vnd.ms-excel

참고