略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: mb_http_input

2024-12-21

mb_http_input

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

mb_http_input检测 HTTP 输入字符编码

说明

mb_http_input(string $type = ""): mixed

检测 HTTP 输入字符的编码。

参数

type

设置的字符串指定了输入类型。 "G" 是 GET,"P" 是 POST,"C" 是 COOKIE,"S" 是 string,"L" 是 list,以及 "I" 是整个列表(将会返回 array)。 如果省略了 type,它将返回最后处理的一种输入类型。

返回值

每个 type 的字符编码名称。 如果 mb_http_input() 没有处理过任何指定的 HTTP 输入,它将返回 false

参见

add a noteadd a note

User Contributed Notes 2 notes

up
-4
Timido
9 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
14 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.

官方地址:https://www.php.net/manual/en/function.mb-http-input.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3