JSON 编码解码类¶
| 属性 | 值 |
|---|---|
| 命名空间 | fize\crypt |
| 类名 | Json |
| 方法: |
|---|
| 方法名 | 说明 |
|---|---|
| decode() | 对 JSON 格式的字符串进行编码 |
| encode() | 对变量进行 JSON 编码 |
| lastErrorMsg() | 获取最后的错误描述 |
| lastError() | 返回最后发生的错误 |
方法¶
decode()¶
对 JSON 格式的字符串进行编码
public static function decode (
string $json,
bool $assoc = true,
int $depth = 512,
int $options = 0
) : array|object
| 参数: |
|
|---|
encode()¶
对变量进行 JSON 编码
public static function encode (
mixed $value,
int $options = 0,
int $depth = 512
) : string
| 参数: |
|
|---|
该函数只能接受 UTF-8 编码的数据