im-denisenko/php-json-encode 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

im-denisenko/php-json-encode

最新稳定版本:0.0.3

Composer 安装命令:

composer require im-denisenko/php-json-encode

包简介

Provides features, added to json_encode since version 5.3.0, for version 5.3.0.

README 文档

README

Build Status

Provides features, added to json_encode since version 5.3.0, for version 5.3.0.

Reference

  • >=5.5.0 Third parameter $depth allow let you set the maximum depth.

  • >=5.4.0 Option JSON_PRETTY_PRINT let use whitespace in returned data to format it.

  • >=5.4.0 Option JSON_UNESCAPED_SLASHES let don't escape /.

  • >=5.4.0 Option JSON_UNESCAPED_UNICODE let encode multibyte Unicode characters literally (default is to escape as \uXXXX).

  • >=5.3.3 Option JSON_NUMERIC_CHECK let you encode numeric strings as numbers.

Usage

$data = array('foo' => 'bar');
echo Future\Json::encode($data, JSON_PRETTY_PRINT);
echo Future\Json::encode($data, JSON_NUMERIC_CHECK);
echo Future\Json::encode($data, JSON_UNESCAPED_SLASHES);
echo Future\Json::encode($data, JSON_UNESCAPED_UNICODE);
echo Future\Json::encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
echo Future\Json::encode($data, null, 4);

Shortcut

If you dont like Namespace\Classname::staticMethod call, you can use shortcuts.

future_json_encode($data, JSON_UNESCAPED_UNICODE, 10);

Testing

If current version PHP allow to use features described above, then encoder will pass all arguments to native function instead.

Directory tests/ contains json files that were generated using native function in PHP 5.5.6.

You can run the unit tests just to be sure that you will get exactly the same result regardless of your system:

$ composer install --dev
$ vendor/bin/phpunit tests/

统计信息

  • 总下载量: 128
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固