tc/json
Composer 安装命令:
composer require tc/json
包简介
A JSON encode/decode helper with easier error handling for PHP
README 文档
README
A JSON encode/decode helper with easier error handling for PHP
Installation
composer require tc/json
Usage
<?php use Tc\Json\Json; use Tc\Json\JsonException; $data = [ 'foo' => 'bar', ]; $jsonString = Json::encode($data); // {"foo": "bar"} $jsonDataObject = Json::decode($jsonString); // ( [foo] => bar ) $jsonDataArray = Json::decode($jsonString, true ); // ['foo' => 'bar'] $jsonData = Json::decode($jsonString, true); // ['foo' => 'bar'] try { Json::decode('{"foo"'); // invalid json string } catch(JsonException $e) { echo $e->getMessage(); // description of error }
License
Tc Json is licensed with the MIT license.
See LICENSE for more details.
统计信息
- 总下载量: 26
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-03-03