JSON 常量详情参考 (内含对中文不转义的参数)
JSON_ERROR_NONE (integer)
没有错误发生。自 PHP 5.3.0 起生效。
JSON_ERROR_DEPTH (integer)
到达了最大堆栈深度。自 PHP 5.3.0 起生效。
JSON_ERROR_STATE_MISMATCH (integer)
出现了下溢(underflow)或者模式不匹配。自 PHP 5.3.0 起生效。
JSON_ERROR_CTRL_CHAR (integer)
控制字符错误,可能是编码不对。自 PHP 5.3.0 起生效。
JSON_ERROR_SYNTAX (integer)
语法错误。 自 PHP 5.3.0 起生效。
JSON_ERROR_UTF8 (integer)
异常的 UTF-8 字符,也许是因为不正确的编码。 自 PHP 5.3.3 起生效。
JSON_ERROR_RECURSION (integer)
The object or array passed to json_encode() include recursive references and cannot be encoded. If the JSON_PARTIAL_OUTPUT_ON_ERROR option was given, NULL will be encoded in the place of the recursive reference. Available since PHP 5.5.0.
JSON_ERROR_INF_OR_NAN (integer)
The value passed to json_encode() includes either NAN or INF. If the JSON_PARTIAL_OUTPUT_ON_ERROR option was given, 0 will be encoded in the place of these special numbers. Available since PHP 5.5.0.
JSON_ERROR_UNSUPPORTED_TYPE (integer)
A value of an unsupported type was given to json_encode(), such as a resource. If the JSON_PARTIAL_OUTPUT_ON_ERROR option was given, NULL will be encoded in the place of the unsupported value. Available since PHP 5.5.0.
JSON_ERROR_INVALID_PROPERTY_NAME (integer)
A key starting with \u0000 character was in the string passed to json_decode() when decoding a JSON object into a PHP object. Available since PHP 7.0.0.
JSON_ERROR_UTF16 (integer)
Single unpaired UTF-16 surrogate in unicode escape contained in the JSON string passed to json_encode(). Available since PHP 7.0.0.
下面的常量可以和 json_decode() 的 form 选项结合使用。 JSON_BIGINT_AS_STRING (integer)
将大数字编码成原始字符原来的值。 自 PHP 5.4.0 起生效。
JSON_OBJECT_AS_ARRAY (integer)
Decodes JSON objects as PHP array. This option can be added automatically by calling json_decode() with the second parameter equal to TRUE. Available since PHP 5.4.0.
下面的常量可以和 json_encode() 的 form 选项结合使用。 JSON_HEX_TAG (integer)
所有的 < 和 > 转换成 \u003C 和 \u003E。 自 PHP 5.3.0 起生效。
JSON_HEX_AMP (integer)
所有的 & 转换成 \u0026。 自 PHP 5.3.0 起生效。
JSON_HEX_APOS (integer)
所有的 ' 转换成 \u0027。 自 PHP 5.3.0 起生效。
JSON_HEX_QUOT (integer)
所有的 " 转换成 \u0022。 自 PHP 5.3.0 起生效。
JSON_FORCE_OBJECT (integer)
使一个非关联数组输出一个类(Object)而非数组。 在数组为空而接受者需要一个类(Object)的时候尤其有用。 自 PHP 5.3.0 起生效。
JSON_NUMERIC_CHECK (integer)
将所有数字字符串编码成数字(numbers)。 自 PHP 5.3.3 起生效。
JSON_PRETTY_PRINT (integer)
用空白字符格式化返回的数据。 自 PHP 5.4.0 起生效。
JSON_UNESCAPED_SLASHES (integer)
不要编码 /。 自 PHP 5.4.0 起生效。
JSON_UNESCAPED_UNICODE (integer)
以字面编码多字节 Unicode 字符(默认是编码成 \uXXXX)。 自 PHP 5.4.0 起生效。
JSON_PARTIAL_OUTPUT_ON_ERROR (integer)
Substitute some unencodable values instead of failing. Available since PHP 5.5.0.
JSON_PRESERVE_ZERO_FRACTION (integer)
Ensures that float values are always encoded as a float value. Available since PHP 5.6.6.
JSON_UNESCAPED_LINE_TERMINATORS (integer)
The line terminators are kept unescaped when JSON_UNESCAPED_UNICODE is supplied. It uses the same behaviour as it was before PHP 7.1 without this constant. Available since PHP 7.1.0.
JSON 常量详情参考 (内含对中文不转义的参数)的更多相关文章
- 放弃"指针常量"这种不严谨的中文描述!深度理解数组名、指针常量
ques1: 数组名完全等价于指针常量吗? int array[10] = { 10,11,12,13,14,15 }; printf("sizeof(array)= %d \n" ...
- 试用 ModVB(一):安装教程+使用 JSON 常量和 JSON 模式匹配
前排提醒:阅读此文章并充分尝试 ModVB 的新语法需要较长的时间.对于程序员而言,如果你工作时不用 VB,则最好避免在上班时间看,以免被领导认为你在长时间摸鱼. 什么是 ModVB ModVB 是一 ...
- Python+requests r.json()获取的内容,控制台显示中文Unicode转为utf-8《九》
在接口测试中,直接使用r.json()获取到的结果,难免会在结果中带有中文,但是在控制台的中文输出默认是Unicode编码,不能通过统一在设置中进行设置utf-8,因此为了在控制台更显而易见的显示出中 ...
- JQuery和JSON方式参数传递并处理JAVAWEB中文乱码问题
本文主要讲springMVC中视图和控制器之间常用的两种传递参数的方式: 1.JQuery 2.JSON 一.JQuery方式 思路:单击按钮后,触发JQuery事件,而提交整个表单 JSP中 < ...
- 解决ASP.NET Web API Json对象循环参考错误
前言 一般我们在开法 ASP.NET Web API 时,如果是使用 Entity Framework 技术来操作数据库的话,当两个 Entity 之间包含导览属性(Navigation Proper ...
- ajax中url赋json格式的值时发生中文乱码的相关问题
具体流程:转入到jsp界面时会加载ajax,ajax转到url时传带hide在jsp界面的值titleString,其来源见下面的代码. String title=new String("\ ...
- 让Jackson JSON生成的数据包含的中文以unicode方式编码
本文出处:http://blog.csdn.net/chaijunkun/article/details/8257209,转载请注明.由于本人不定期会整理相关博文,会对相应内容作出完善.因此强烈建 ...
- json前后台传输,以及乱码中文问题探讨
背景介绍: 我现在的工作是做传统项目开发,没有用到框架.最近在做项目时,经常需要使用ajax从后台拿数据到前台,是json格式的.先说下我在项目中遇到的问题吧,前台拿到了数据,需要将其转化为对象,我使 ...
- 如何让Jackson JSON生成的数据包含的中文以unicode方式编码
我们都知道,Jackson JSON以高速.方便和灵活著称.之前的文章中介绍过使用注解的形式来规定如何将一个对象序列化成JSON的方法,以及如何将一个JSON数据反序列化到一个对象上.但是美中不足的一 ...
随机推荐
- 这些年、我收集的JQuery代码 (转)
1. 如何创建嵌套的过滤器 //允许你减少集合中的匹配元素的过滤器, //只剩下那些与给定的选择器匹配的部分.在这种情况下, //查询删除了任何没(:not)有(:has) //包含class为“se ...
- Springboot 实现前台动态配置数据源 (修改数据源之后自动重启)
1.将 db.properties 存放在classpath路径; driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3 ...
- 黑马学习连接池 druid JdbcTemplate c3p0 池技术
package cn.itcast.jdbctemplate; import org.junit.Test; import org.springframework.jdbc.core.BeanProp ...
- hdu6441 Find Integer 求勾股数 费马大定理
题目传送门 题目大意: 给出a和n,求满足的b和c. 思路: 数论题目,没什么好说的. 根据费马大定理,当n>2时不存在正整数解. 当n=0或者1时特判一下就可以了,也就是此时变成了一个求勾股数 ...
- 一个基于QT简单登录对话框(带验证码功能)
1. 对话框样式 2. 源代码 ①. main.cpp #include <QtGui/QApplication> #include "QLoginDialog.h" ...
- asp.net搭建项目架构
项目的架构决定这个项目的好坏. 今天我说说传统三层架构的搭建 第一步 创建一个解决方案 例如 TaskSystem 接着这个解决方案下创建六个项目分别: TaskSystem.DAL TaskSyst ...
- hadoop单机配置
条件: 先下载VMware1.2,然后安装. 下载ubuntu-1.4.05-desktop-amd64.iso.下载地址:http://mirrors.aliyun.com/ubuntu-relea ...
- Linux配置SSH免密码登录
CentOS配置SSH免密码登录为例说明:SSH远程登录的安全外壳协议有两种身份认证机制: - 用户名+密码 -密钥登录 环境准备 host1:192.168.0.10host2:192.168.0. ...
- Maven使用之packing篇
项目的打包类型:pom.jar.war 项目中一般使用maven进行模块管理,每个模块下对应都有一个pom文件,pom文件中维护了各模块之间的依赖和继承关系.项目模块化可以将通用的部分抽离出来,方便重 ...
- Turn.js 实现翻书效果
Turn.js的官方网址: http://www.turnjs.com/ 官网上运行demo如下,大家主要关注是 属性使用: <!DOCTYPE html> <html> &l ...