當(dāng)前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
JSON 常量详情参考 (内含对中文不转义的参数)
生活随笔
收集整理的這篇文章主要介紹了
JSON 常量详情参考 (内含对中文不转义的参数)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
JSON_ERROR_NONE (integer)
沒有錯誤發(fā)生。自 PHP 5.3.0 起生效。
JSON_ERROR_DEPTH (integer)
到達(dá)了最大堆棧深度。自 PHP 5.3.0 起生效。
JSON_ERROR_STATE_MISMATCH (integer)
出現(xiàn)了下溢(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 選項結(jié)合使用。JSON_BIGINT_AS_STRING (integer)
將大數(shù)字編碼成原始字符原來的值。 自 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 選項結(jié)合使用。JSON_HEX_TAG (integer)
所有的 < 和 > 轉(zhuǎn)換成 \u003C 和 \u003E。 自 PHP 5.3.0 起生效。
JSON_HEX_AMP (integer)
所有的 & 轉(zhuǎn)換成 \u0026。 自 PHP 5.3.0 起生效。
JSON_HEX_APOS (integer)
所有的 ' 轉(zhuǎn)換成 \u0027。 自 PHP 5.3.0 起生效。
JSON_HEX_QUOT (integer)
所有的 " 轉(zhuǎn)換成 \u0022。 自 PHP 5.3.0 起生效。
JSON_FORCE_OBJECT (integer)
使一個非關(guān)聯(lián)數(shù)組輸出一個類(Object)而非數(shù)組。 在數(shù)組為空而接受者需要一個類(Object)的時候尤其有用。 自 PHP 5.3.0 起生效。
JSON_NUMERIC_CHECK (integer)
將所有數(shù)字字符串編碼成數(shù)字(numbers)。 自 PHP 5.3.3 起生效。
JSON_PRETTY_PRINT (integer)
用空白字符格式化返回的數(shù)據(jù)。 自 PHP 5.4.0 起生效。
JSON_UNESCAPED_SLASHES (integer)
不要編碼 /。 自 PHP 5.4.0 起生效。
JSON_UNESCAPED_UNICODE (integer)
以字面編碼多字節(jié) Unicode 字符(默認(rèn)是編碼成 \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.
?
轉(zhuǎn)載于:https://www.cnblogs.com/longlonglong/p/9466845.html
與50位技術(shù)專家面對面20年技術(shù)見證,附贈技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的JSON 常量详情参考 (内含对中文不转义的参数)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java中String类型的概述
- 下一篇: Java - 用数组求出斐波那契数列的前