Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions reference/curl/functions/curl-upkeep.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: fc9a0a8b29a7a099998bdd71fe5350a10b18fe62 Maintainer: lacatoire Status: ready -->
<refentry xml:id="function.curl_upkeep" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>curl_upkeep</refname>
<refpurpose>执行连接保活检查</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>curl_upkeep</methodname>
<methodparam><type>CurlHandle</type><parameter>handle</parameter></methodparam>
</methodsynopsis>
<para>
需要使用 libcurl &gt;= 7.62.0 构建才可用。
</para>
<para>
某些协议具有"连接保活"机制。
这些机制通常会在现有连接上发送少量流量以保持连接活跃;
例如,这可以防止连接被过于严格的防火墙关闭。
</para>
<para>
连接保活目前仅适用于 HTTP/2 连接。
通常会发送少量流量来保持连接活跃。
HTTP/2 通过发送 HTTP/2 PING 帧来维持其连接。
</para>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
&curl.ch.description;
</variablelist>
</para>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>curl_upkeep</function> 示例</title>
<programlisting role="php">
<![CDATA[
<?php
$url = "https://example.com";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_2_0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_UPKEEP_INTERVAL_MS, 200);
if (curl_exec($ch)) {
usleep(300);
var_dump(curl_upkeep($ch));
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>curl_init</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
23 changes: 11 additions & 12 deletions reference/json/functions/json-decode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@
<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>.
空的 JSON key("")可以被编码为空的对象属性,而不是使用值为
<literal>_empty_</literal> 的键。
</entry>
</row>
</tbody>
Expand Down Expand Up @@ -169,11 +169,10 @@ array(5) {
</screen>
</example>
<example>
<title>Accessing invalid object properties</title>
<title>访问无效的对象属性</title>
<simpara>
Accessing elements within an object that contain characters not
permitted under PHP's naming convention (e.g. the hyphen) can be
accomplished by encapsulating the element name within braces and the apostrophe.
可以通过将元素名称用花括号和单引号括起来,来访问对象中包含 PHP
命名约定不允许的字符(例如连字符)的元素。
</simpara>
<programlisting role="php">
<![CDATA[
Expand All @@ -189,7 +188,7 @@ print $obj->{'foo-bar'}; // 12345
</programlisting>
</example>
<example>
<title>common mistakes using <function>json_decode</function></title>
<title>使用 <function>json_decode</function> 的常见错误</title>
<programlisting role="php">
<![CDATA[
<?php
Expand All @@ -214,7 +213,7 @@ json_decode($bad_json); // null
</programlisting>
</example>
<example>
<title><parameter>depth</parameter> errors</title>
<title><parameter>depth</parameter> 错误</title>
<programlisting role="php">
<![CDATA[
<?php
Expand Down Expand Up @@ -273,7 +272,7 @@ Last error: Maximum stack depth exceeded
</screen>
</example>
<example>
<title><function>json_decode</function> of large integers</title>
<title><function>json_decode</function> 处理大整数</title>
<programlisting role="php">
<![CDATA[
<?php
Expand Down Expand Up @@ -306,13 +305,13 @@ object(stdClass)#1 (1) {
&reftitle.notes;
<note>
<para>
The JSON spec is not JavaScript, but a subset of JavaScript.
JSON 规范不是 JavaScript,而是 JavaScript 的一个子集。
</para>
</note>
<note>
<para>
In the event of a failure to decode, <function>json_last_error</function>
can be used to determine the exact nature of the error.
如果解码失败,可以使用 <function>json_last_error</function>
来确定错误的确切性质。
</para>
</note>
</refsect1>
Expand Down
15 changes: 10 additions & 5 deletions reference/json/functions/json-last-error.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 7100979e254970cef72c6f91b32352e7c7898635 Maintainer: daijie Status: ready -->
<!-- EN-Revision: 058ea1e8420b9c1b24402af52545e8313428e1d1 Maintainer: daijie Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="function.json-last-error" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down Expand Up @@ -72,16 +72,16 @@
</row>
<row>
<entry><constant>JSON_ERROR_RECURSION</constant></entry>
<entry>One or more recursive references in the value to be encoded</entry>
<entry>待编码的值中存在一个或多个递归引用</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_INF_OR_NAN</constant></entry>
<entry>
One or more
待编码的值中存在一个或多个
<link linkend="language.types.float.nan"><constant>NAN</constant></link>
or <link linkend="function.is-infinite"><constant>INF</constant></link>
values in the value to be encoded
<link linkend="function.is-infinite"><constant>INF</constant></link>
</entry>
<entry></entry>
</row>
Expand All @@ -100,6 +100,11 @@
<entry>畸形的 UTF-16 字符,可能因为字符编码不正确。</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_NON_BACKED_ENUM</constant></entry>
<entry>值包含无法序列化的非回退枚举。自 PHP 8.1.0 起可用。</entry>
<entry></entry>
</row>
</tbody>
</tgroup>
</table>
Expand Down
90 changes: 90 additions & 0 deletions reference/pcre/functions/preg-last-error-msg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 3ec7b61315855e9783e20187f457399a44dd9948 Maintainer: lacatoire Status: ready -->
<refentry xml:id="function.preg-last-error-msg" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>preg_last_error_msg</refname>
<refpurpose>返回最后一个 PCRE 正则表达式执行产生的错误信息</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>preg_last_error_msg</methodname>
<void />
</methodsynopsis>
<para>
返回最后一次 PCRE 正则表达式执行产生的错误信息。
</para>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
成功时返回错误信息,如果没有发生错误则返回 <literal>"No error"</literal>。
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>preg_last_error_msg</function> 示例</title>
<programlisting role="php">
<![CDATA[
<?php

preg_match('/(?:\D+|<\d+>)*[!?]/', 'foobar foobar foobar');

if (preg_last_error() !== PREG_NO_ERROR) {
echo preg_last_error_msg();
}

?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Backtrack limit exhausted
]]>
</screen>
</example>
</para>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>preg_last_error</function></member>
</simplelist>
</para>
</refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
Loading