json_decode — 对 JSON 格式的字符串进行编码
说明
mixed
json_decode (
string $json [,
bool $assoc = false [,
int $depth = 512 [,
int $options = 0 ]]] )
参数
json
-
待解码的 json string 格式的字符串。
This function only works with UTF-8 encoded data.
assoc
-
当该参数为 TRUE 时,将返回 array 而非 object 。
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)
返回值
assoc设置为true时返回数组,false时返回对象。
Returns the value encoded in json in appropriate PHP type. Values true, false and null (case-insensitive) are returned as TRUE , FALSE and NULL respectively. NULL is returned if the json cannot be decoded or if the encoded data is deeper than the recursion limit.
|