Forum und email

HttpResponse::guessContentType

(PECL pecl_http:0.13.0-1.5.5)

HttpResponse::guessContentType — content type を推測する

説明

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

指定された本文の content type を、libmagic を使用して推測します。

推測に成功すると、その結果の Content-Type が自動的にレスポンスの Content-Type として設定されます。

パラメータ

magic_file

使用する magic.mime データベース。

magic_mode

libmagic のフラグ。

返り値

成功した場合は推測した content type、 失敗した場合は FALSE を返します。

エラー / 例外

HttpRuntimeException、HttpInvalidParamException をスローします。