json_decode ( string $json
[, bool $assoc
= false [, int $depth
= 512 [, int $options
= 0 ]]] )
接受一个 JSON 编码的字符串并且把它转换为 PHP 变量
-
json
-
待解码的
json
格式的字符串。这个函数仅能处理 UTF-8 编码的数据。
Note:
PHP implements a superset of JSON as specified in the original - it will also encode and decode scalar types and
NULL
. RFC 4627 only supports these values when they are nested inside an array or an object.Although this superset is consistent with the expanded definition of "JSON text" in the newer (which aims to supersede RFC 4627) and , this may cause interoperability issues with older JSON parsers that adhere strictly to RFC 4627 when encoding a single scalar value.
-
assoc
-
当该参数为
TRUE
时,将返回 而非 。 -
depth
-
User specified recursion depth.
-
options
-
Bitmask of JSON decode options. Currently only
JSON_BIGINT_AS_STRING
is supported (default is to cast large integers as floats)