JSON函数

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 字符,也许是因为不正确的编码。
*/


转载于:https://my.oschina.net/chmen/blog/663945

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值