finfo_fileとは何? わかりやすく解説 Weblio辞書 (original) (raw)
finfo_file
(PECL)
finfo_file — ファイルについての情報を返す
説明
string finfo_file ( resource finfo, string file_name [, int options [, resource context]] )
class finfo {
string file ( string file_name [, int options [, resource context]] )
} この関数は、ファイルについての情報を返すために使用します。
パラメータ
finfo
finfo_open() が返す fileinfo リソース。
file_name
調べるファイルの名前。
options
ひとつあるいは複数のFileinfo 定数の組み合わせ。
context
contexts の説明については、ストリーム を参照ください。
返り値
filename のテキスト表現、あるいはエラーが発生した場合にFALSE を返します。
例
例 585. finfo_file() の例<?php $finfo = finfo_open(FILEINFO_MIME); // 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
## 参考finfo_buffer()
急上昇のことば
- finfo_fileのページへのリンク

