svn: /phpdoc/zh/trunk/reference/json/functions/ json-decode.xml
[email protected] (CHU Zhaowei) Sat, 24 Aug 2019 17:56:59 +0000
| Newsgroups | php.doc.zh |
|---|---|
| Message-ID | <[email protected]> |
jhdxr Sat, 24 Aug 2019 17:56:59 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=347891
Log:
sync with en version
Changed paths:
U phpdoc/zh/trunk/reference/json/functions/json-decode.xml
svn-diffs-347891.txt
(text/x-diff, 8.1 KB)
Modified: phpdoc/zh/trunk/reference/json/functions/json-decode.xml
===================================================================
--- phpdoc/zh/trunk/reference/json/functions/json-decode.xml 2019-08-23 14:44:59 UTC (rev 347890)
+++ phpdoc/zh/trunk/reference/json/functions/json-decode.xml 2019-08-24 17:56:59 UTC (rev 347891)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
-<!-- EN-Revision: 341596 Maintainer: jhdxr Status: ready -->
+<!-- EN-Revision: 347250 Maintainer: jhdxr -->
<refentry xml:id="function.json-decode" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>json_decode</refname>
@@ -12,7 +12,7 @@
<methodsynopsis>
<type>mixed</type><methodname>json_decode</methodname>
<methodparam><type>string</type><parameter>json</parameter></methodparam>
- <methodparam choice="opt"><type>bool</type><parameter>assoc</parameter><initializer>false</initializer></methodparam>
+ <methodparam choice="opt"><type>bool</type><parameter>assoc</parameter><initializer>&false;</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>depth</parameter><initializer>512</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter><initializer>0</initializer></methodparam>
</methodsynopsis>
@@ -41,7 +41,7 @@
<term><parameter>assoc</parameter></term>
<listitem>
<para>
- 当该参数为 &true; 时,将返回 <type>array</type> 而非 <type>object</type> 。
+ 当该参数为 &true; 时,将返回 &array; 而非 &object; 。
</para>
</listitem>
</varlistentry>
@@ -57,11 +57,14 @@
<term><parameter>options</parameter></term>
<listitem>
<para>
- JSON解码的掩码选项。 现在有两个支持的选项。
- 第一个是<constant>JSON_BIGINT_AS_STRING</constant>,
- 用于将大整数转为字符串而非默认的float类型。第二个是
- <constant>JSON_OBJECT_AS_ARRAY</constant>,
- 与将<parameter>assoc</parameter>设置为 &true; 有相同的效果。
+ 由
+ <constant>JSON_BIGINT_AS_STRING</constant>,
+ <constant>JSON_INVALID_UTF8_IGNORE</constant>,
+ <constant>JSON_INVALID_UTF8_SUBSTITUTE</constant>,
+ <constant>JSON_OBJECT_AS_ARRAY</constant>,
+ <constant>JSON_THROW_ON_ERROR</constant>
+ 组成的掩码。
+ 这些常量的行为在<link linkend="json.constants">JSON constants</link>页面有进一步描述。
</para>
</listitem>
</varlistentry>
@@ -72,14 +75,111 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
- Returns the value encoded in <parameter>json</parameter> in appropriate
- PHP type. Values <literal>true</literal>, <literal>false</literal> and
- <literal>null</literal> are returned as &true;, &false; and &null;
- respectively. &null; is returned if the <parameter>json</parameter> cannot
- be decoded or if the encoded data is deeper than the recursion limit.
+ 通过恰当的 PHP 类型返回在 <parameter>json</parameter>
+ 中编码的数据。值<literal>true</literal>, <literal>false</literal> 和 <literal>null</literal>
+ 会相应地返回 &true;, &false; 和 &null;。
+ 如果 <parameter>json</parameter> 无法被解码,
+ 或者编码数据深度超过了递归限制的话,将会返回&null; 。
</para>
</refsect1>
+
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>7.3.0</entry>
+ <entry>
+ <constant>JSON_THROW_ON_ERROR</constant>
+ <parameter>options</parameter> was added.
+ </entry>
+ </row>
+ <row>
+ <entry>7.2.0</entry>
+ <entry>
+ <constant>JSON_INVALID_UTF8_IGNORE</constant>, and
+ <constant>JSON_INVALID_UTF8_SUBSTITUTE</constant>
+ <parameter>options</parameter> were added.
+ </entry>
+ </row>
+ <row>
+ <entry>7.1.0</entry>
+ <entry>
+ An empty JSON key ("") can be encoded to the empty object property
+ instead of using a key with value <literal>_empty_</literal>.
+ </entry>
+ </row>
+ <row>
+ <entry>7.0.0</entry>
+ <entry>
+ Rejected RFC 7159 incompatible number formats - top level
+ (07, 0xff, .1, -.1) and all levels ([1.], [1.e1])
+ </entry>
+ </row>
+ <row>
+ <entry>7.0.0</entry>
+ <entry>
+ An empty PHP string or value that after casting to string is an empty
+ string (<literal>NULL</literal>, <literal>FALSE</literal>) results
+ in JSON syntax error.
+ </entry>
+ </row>
+ <row>
+ <entry>5.6.0</entry>
+ <entry>
+ Invalid non-lowercased variants of the <literal>true</literal>,
+ <literal>false</literal> and <literal>null</literal> literals are no
+ longer accepted as valid input, and will generate warnings.
+ </entry>
+ </row>
+ <row>
+ <entry>5.4.0</entry>
+ <entry>
+ <constant>JSON_BIGINT_AS_STRING</constant>, and
+ <constant>JSON_OBJECT_AS_ARRAY</constant>
+ <parameter>options</parameter> were added.
+ </entry>
+ </row>
+ <row>
+ <entry>5.4.0</entry>
+ <entry>
+ The <parameter>options</parameter> parameter was added.
+ </entry>
+ </row>
+ <row>
+ <entry>5.3.0</entry>
+ <entry>
+ Added the optional <parameter>depth</parameter>. The default
+ recursion depth was increased from 128 to 512
+ </entry>
+ </row>
+ <row>
+ <entry>5.2.3</entry>
+ <entry>
+ The nesting limit was increased from 20 to 128
+ </entry>
+ </row>
+ <row>
+ <entry>5.2.1</entry>
+ <entry>
+ Added support for JSON decoding of basic types.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </refsect1>
+
<refsect1 role="examples">
&reftitle.examples;
<para>
@@ -274,74 +374,6 @@
</note>
</refsect1>
- <refsect1 role="changelog">
- &reftitle.changelog;
- <para>
- <informaltable>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>&Version;</entry>
- <entry>&Description;</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>7.1.0</entry>
- <entry>
- An empty JSON key ("") can be encoded to the empty object property
- instead of using a key with value <literal>_empty_</literal>.
- </entry>
- </row>
- <row>
- <entry>7.0.0</entry>
- <entry>
- Rejected RFC 7159 incompatible number formats - top level
- (07, 0xff, .1, -.1) and all levels ([1.], [1.e1])
- </entry>
- </row>
- <row>
- <entry>7.0.0</entry>
- <entry>
- An empty PHP string or value that after casting to string is an empty
- string (<literal>NULL</literal>, <literal>FALSE</literal>) results
- in JSON syntax error.
- </entry>
- </row>
- <row>
- <entry>5.6.0</entry>
- <entry>
- Invalid non-lowercased variants of the <literal>true</literal>,
- <literal>false</literal> and <literal>null</literal> literals are no
- longer accepted as valid input, and will generate warnings.
- </entry>
- </row>
- <row>
- <entry>5.4.0</entry>
- <entry>
- The <parameter>options</parameter> parameter was added.
- </entry>
- </row>
- <row>
- <entry>5.3.0</entry>
- <entry>Added the optional <parameter>depth</parameter>. The default recursion depth was increased from 128 to 512</entry>
- </row>
- <row>
- <entry>5.2.3</entry>
- <entry>The nesting limit was increased from 20 to 128</entry>
- </row>
- <row>
- <entry>5.2.1</entry>
- <entry>
- Added support for JSON decoding of basic types.
- </entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </para>
- </refsect1>
-
<refsect1 role="seealso">
&reftitle.seealso;
<para>