Fileinfo Functions
简介
The functions in this module try to guess the content type and encoding of a file by looking for certain magic byte sequences at specific positions within the file. While this is not a bullet proof approach the heuristics used do a very good job.
需求
magic_open library is needed to build this extension.
安装
安装此 PECL 扩展库的信息可在手册中标题为 PECL 扩展库安装的一章中找到。 更多信息如新版本,下载,源文件,维护者信息以及更新日志等可以在这里找到: » https://pecl.php.net/package/fileinfo
运行时配置
本扩展模块在 php.ini 中未定义任何配置选项。
资源类型
There is one resource used in Fileinfo extension: a magic database descriptor returned by finfo_open().
预定义常量
以下常量由本扩展模块定义,因此只有在本扩展模块被编译到 PHP 中,或者在运行时被动态加载后才有效。
- FILEINFO_NONE (integer)
- No special handling.
- FILEINFO_SYMLINK (integer)
- Follow symlinks.
- FILEINFO_MIME (integer)
- Return a mime string, instead of a textual description.
- FILEINFO_COMPRESS (integer)
- Decompress compressed files.
- FILEINFO_DEVICES (integer)
- Look at the contents of blocks or character special devices.
- FILEINFO_CONTINUE (integer)
- Return all matches, not just the first.
- FILEINFO_PRESERVE_ATIME (integer)
- If possible preserve the original access time.
- FILEINFO_RAW (integer)
- Don't translate unprintable characters to a \ooo octal representation.
Table of Contents
- finfo_buffer — Return information about a string buffer
- finfo_close — Close fileinfo resource
- finfo_file — Return information about a file
- finfo_open — Create a new fileinfo resource
- finfo_set_flags — Set libmagic configuration options