finfo_bufferfinfo::buffer 返回一个字符串缓冲区的信息

发表日期:2021-07-01 08:55:35 | 来源: | | 浏览(436) 分类:Fileinfo 函数

finfo_buffer

finfo::buffer

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL fileinfo >= 0.1.0)

finfo_buffer -- finfo::buffer返回一个字符串缓冲区的信息

说明

过程化风格

finfo_buffer(
    resource $finfo,
    string $string = null,
    int $options = FILEINFO_NONE,
    resource $context = null
): string

面向对象风格

public finfo::buffer(string $string = null, int $options = FILEINFO_NONE, resource $context = null): string

本函数用来获取字符串中二进制数据的信息。

参数

finfo

finfo_open() 函数返回的 Fileinfo 资源。

string

要检查的文件内容。

options

一个 Fileinfo 常量 或多个 Fileinfo 常量 进行逻辑或运算。

context

返回值

返回 string 参数所指定内容的类型描述。 发生错误时返回 false

范例

示例 #1 finfo_buffer() 函数例程

<?php 
$finfo = new finfo(FILEINFO_MIME);
echo $finfo->buffer($_POST["script"]) . "\n";
?>

以上例程的输出类似于:

application/x-sh; charset=us-ascii

参见

  • finfo_file() - 别名 finfo_file()

集速网 copyRight © 2015-2022 宁ICP备15000399号-1 宁公网安备 64010402001209号
与其临渊羡鱼,不如退而结网
欢迎转载、分享、引用、推荐、收藏。