- 授权协议: 未知
- 开发语言: PHP
- 操作系统: 跨平台
- 软件首页: https://github.com/rryqszq4/php-cjson
- 软件文档: https://github.com/rryqszq4/php-cjson
软件介绍
php-cjson 是快速的 JSON 解析和生成的 PHP 库,基于 cjson 底层 C 库开发。
安装
$/path/to/phpize $./configure --with-php-config=/path/to/php-config $make && make install
示例
encode
$arr = array(
1,
"string",
array("key"=>"value")
);
var_dump(cjson_encode($arr));
/* ==>output
string(28) "[1,"string",{"key":"value"}]";
*/
decode
$str = '[1,"string",{"key":"value"}]';
var_dump(cjson_decode($str));
/* ==>output
array(3) {
[0]=>
int(1)
[1]=>
string(6) "string"
[2]=>
array(1) {
["key"]=>
string(5) "value"
}
}
*/
