mb_http_input

(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)

mb_http_inputHTTP 入力文字エンコーディングを検出する

説明

mb_http_input(?string $type = null): array|string|false

HTTP 入力文字エンコーディングを検出します。

パラメータ

type

HTTP 入力の型を表す文字列を入力してください。 GET の場合は "G"、POST の場合は "P"、 COOKIE の場合は "C"、文字列の場合は "S"、 リストの場合は "L"、リスト全体(配列を返す) の場合は "I" です。 type が省略された場合、 直近に処理された入力型が返されます。

戻り値

type の文字エンコーディング名を返します。 type"I" の場合は、 文字エンコーディング名の配列を返します。 mb_http_input() が指定した HTTP 入力の処理を行っていない場合、false を返します。

変更履歴

バージョン 説明
8.0.0 type は、nullable になりました。

参考

  • mb_internal_encoding() - 内部文字エンコーディングを設定あるいは取得する
  • mb_http_output() - HTTP 出力文字エンコーディングを設定あるいは取得する
  • mb_detect_order() - 文字エンコーディング検出順序を設定あるいは取得する

add a note add a note

User Contributed Notes 2 notes

up
-4
Timido
11 years ago
"pass" means "no conversion":

See here:
http://php.net/manual/en/mbstring.configuration.php#ini.mbstring.strict-detection

mbstring.http_input           = pass    ; No conversion.
mbstring.http_output          = pass    ; No conversion
up
-7
anders jenbo pc dk
16 years ago
As this does not seam to work (always returns "pass"). you can use

$encoding = mb_detect_encoding(urldecode($REQUEST_URI), 'UTF-8, UTF-7, ASCII, EUC-JP,SJIS, eucJP-win, SJIS-win, JIS, ISO-2022-JP, ISO-8859-1');

to detect the encoding of the url instead, similare steps could be taken to deteck cookies and post data although it would have to be done for each value.
To Top