string json_encode ( mixed $value [, int $options = 0 [, int $depth = 512 ]] )
//*arrays are returned only if you don't define index.
mixed json_decode ( string $json [, bool $assoc = false [, int $depth = 512 [, int $options = 0 ]]] )
//*这个函数仅能处理 UTF-8 编码的数据。
//*当assoc参数为 TRUE 时,将返回 array 而非 object 。
//*Any subsequent key named "_empty_" (or "" [the empty string] again) will overwrite the value.
//*where /\ is the string which doesn't worked.
string json_last_error_msg ( void )
/*
JSON_ERROR_NONE => 'No error',
JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
JSON_ERROR_STATE_MISMATCH => 'State mismatch (invalid or malformed JSON)',
JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded',
JSON_ERROR_SYNTAX => 'Syntax error',
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded'
*/
int json_last_error ( void )
/*
0 = JSON_ERROR_NONE 没有错误发生
1 = JSON_ERROR_DEPTH 到达了最大堆栈深度
2 = JSON_ERROR_STATE_MISMATCH 无效或异常的 JSON
3 = JSON_ERROR_CTRL_CHAR 控制字符错误,可能是编码不对
4 = JSON_ERROR_SYNTAX 语法错误
5 = JSON_ERROR_UTF8 异常的 UTF-8 字符,也许是因为不正确的编码。
*/
JSON函数
点赞
收藏