JSON 解析/生成库 php-yajl

码农软件 · 软件分类 · JSON/BSON开发包 · 2019-03-30 23:28:07

软件介绍

php-yajl 是简单快速的 JSON 解析和生成库,YAJL(Yet Another JSON Library),绑定 PHP 扩展。 

安装:

$/path/to/phpize
$./configure --with-php-config=/path/to/php-config
$make && make install

示例

生成:

$arr = array(
    1,
    "string",
    array("key"=>"value")
);
var_dump(yajl_generate($arr));
/* ==>output
string(28) "[1,"string",{"key":"value"}]";
*/
var_dump(yajl::generate($arr));
/* ==>output
string(28) "[1,"string",{"key":"value"}]";
*/

解析

$str = '[1,"string",{"key":"value"}]';
var_dump(yajl_parse($str));
/* ==>output
array(3) {
  [0]=>
  int(1)
  [1]=>
  string(6) "string"
  [2]=>
  array(1) {
    ["key"]=>
    string(5) "value"
  }
}
*/
var_dump(yajl::parse($str));
/* ==>output
array(3) {
  [0]=>
  int(1)
  [1]=>
  string(6) "string"
  [2]=>
  array(1) {
    ["key"]=>
    string(5) "value"
  }
}
*/

本文地址:https://www.codercto.com/soft/d/2521.html

The Four

The Four

Scott Galloway / Portfolio / 2017-10-3 / USD 28.00

NEW YORK TIMES BESTSELLER USA TODAY BESTSELLER Amazon, Apple, Facebook, and Google are the four most influential companies on the planet. Just about everyone thinks they know how they got there.......一起来看看 《The Four》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

html转js在线工具
html转js在线工具

html转js在线工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换