HttpResponse
PHP 手册

HttpResponse::guessContentType

(PECL pecl_http >= 0.13.0)

HttpResponse::guessContentTypeGuess content type

说明

static string HttpResponse::guessContentType ( string $magic_file [, int $magic_mode = MAGIC_MIME ] )

Attempts to guess the content type of supplied payload through libmagic.

If the attempt is successful, the guessed Content-Type will automatically be set as response Content-Type.

参数

magic_file

specifies the magic.mime database to use

magic_mode

flags for libmagic

返回值

Returns the guessed content type on success 或者在失败时返回 FALSE.

错误/异常

Throws HttpRuntimeException, HttpInvalidParamException.

参见


HttpResponse
PHP 手册