Skip to content

Commit

Permalink
Replace _XXX with _* in constants (php#931)
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-records authored Oct 30, 2024
1 parent 11ac966 commit ed35db2
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 249 deletions.
56 changes: 5 additions & 51 deletions reference/curl/functions/curl-multi-add-handle.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: b7f8c11e56ff1c57a2993e2ed7e5c5ace18637fd Maintainer: mowangjuanzi Status: ready -->
<!-- EN-Revision: 89ae180a851621c308f0ea4604ff2e919aa57a7f Maintainer: mowangjuanzi Status: ready -->
<!-- CREDITS: Luffy -->
<refentry xml:id="function.curl-multi-add-handle" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>curl_multi_add_handle</refname>
<refpurpose>添加普通 cURL 句柄到 cURL 多句柄</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
Expand All @@ -18,7 +19,7 @@
增加 <parameter>handle</parameter> 句柄到多句柄 <parameter>multi_handle</parameter>
</para>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<para>
Expand All @@ -32,7 +33,7 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
成功时返回 0,失败时返回 <constant>CURLM_XXX</constant> 之一的错误码。
成功时返回 0,失败时返回 <constant>CURLM_<replaceable>*</replaceable></constant> 之一的错误码。
</para>
</refsect1>

Expand All @@ -54,53 +55,6 @@
</informaltable>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>curl_multi_add_handle</function> 示例</title>
<para>
此示例将创建两个 cURL 句柄,并把它们加到多句柄中,然后对其异步处理。
</para>
<programlisting role="php">
<![CDATA[
<?php
// 创建一对 cURL 资源
$ch1 = curl_init();
$ch2 = curl_init();
// 设置 URL 和其它相应的选项
curl_setopt($ch1, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/");
curl_setopt($ch2, CURLOPT_HEADER, 0);
// 创建 cURL 多句柄
$mh = curl_multi_init();
// 新增两个句柄
curl_multi_add_handle($mh,$ch1);
curl_multi_add_handle($mh,$ch2);
// 执行多句柄
do {
$status = curl_multi_exec($mh, $active);
if ($active) {
curl_multi_select($mh);
}
} while ($active && $status == CURLM_OK);
// 关闭全部句柄
curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_close($mh);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
Expand Down
86 changes: 5 additions & 81 deletions reference/curl/functions/curl-multi-info-read.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: b7f8c11e56ff1c57a2993e2ed7e5c5ace18637fd Maintainer: mowangjuanzi Status: ready -->
<!-- EN-Revision: 92226911a09278dd440b836583bf382c629cfc63 Maintainer: mowangjuanzi Status: ready -->
<!-- CREDITS: Luffy -->
<refentry xml:id="function.curl-multi-info-read" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>curl_multi_info_read</refname>
<refpurpose>获取当前传输的有关信息</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
Expand All @@ -27,7 +28,7 @@
</para>
</warning>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<para>
Expand All @@ -44,7 +45,7 @@
</variablelist>
</para>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Expand Down Expand Up @@ -96,83 +97,6 @@
</informaltable>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>curl_multi_info_read</function> 示例</title>
<programlisting role="php">
<![CDATA[
<?php
$urls = array(
"http://www.cnn.com/",
"http://www.bbc.co.uk/",
"http://www.yahoo.com/"
);
$mh = curl_multi_init();
foreach ($urls as $i => $url) {
$conn[$i] = curl_init($url);
curl_setopt($conn[$i], CURLOPT_RETURNTRANSFER, 1);
curl_multi_add_handle($mh, $conn[$i]);
}
do {
$status = curl_multi_exec($mh, $active);
if ($active) {
curl_multi_select($mh);
}
while (false !== ($info = curl_multi_info_read($mh))) {
var_dump($info);
}
} while ($active && $status == CURLM_OK);
foreach ($urls as $i => $url) {
$res[$i] = curl_multi_getcontent($conn[$i]);
curl_close($conn[$i]);
}
var_dump(curl_multi_info_read($mh));
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
array(3) {
["msg"]=>
int(1)
["result"]=>
int(0)
["handle"]=>
resource(5) of type (curl)
}
array(3) {
["msg"]=>
int(1)
["result"]=>
int(0)
["handle"]=>
resource(7) of type (curl)
}
array(3) {
["msg"]=>
int(1)
["result"]=>
int(0)
["handle"]=>
resource(6) of type (curl)
}
bool(false)
]]>
</screen>
</example>
</para>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
Expand Down
54 changes: 3 additions & 51 deletions reference/curl/functions/curl-multi-init.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 65d5499d46b23f4e1e4442146cd3ff585d2a91f4 Maintainer: HonestQiao Status: ready -->
<!-- EN-Revision: 92226911a09278dd440b836583bf382c629cfc63 Maintainer: HonestQiao Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<refentry xml:id="function.curl-multi-init" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>curl_multi_init</refname>
<refpurpose>返回新 cURL 批处理句柄</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
Expand All @@ -30,7 +30,7 @@
返回 cURL 批处理句柄。
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
Expand All @@ -53,54 +53,6 @@
</informaltable>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>curl_multi_init</function> 示例</title>
<para>
这个示例将会创建两个 cURL 句柄,把它们加到批处理句柄,然后异步运行它们。
</para>
<programlisting role="php">
<![CDATA[
<?php
// 创建一对 cURL 资源
$ch1 = curl_init();
$ch2 = curl_init();
// 设置 URL 和相应的选项
curl_setopt($ch1, CURLOPT_URL, "http://lxr.php.net/");
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/");
curl_setopt($ch2, CURLOPT_HEADER, 0);
// 创建批处理 cURL 句柄
$mh = curl_multi_init();
// 增加两个句柄
curl_multi_add_handle($mh,$ch1);
curl_multi_add_handle($mh,$ch2);
// 执行批处理句柄
do {
$status = curl_multi_exec($mh, $active);
if ($active) {
curl_multi_select($mh);
}
} while ($active && $status == CURLM_OK);
// 关闭全部句柄
curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_close($mh);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
Expand Down
13 changes: 7 additions & 6 deletions reference/curl/functions/curl-multi-remove-handle.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: b7f8c11e56ff1c57a2993e2ed7e5c5ace18637fd Maintainer: mowangjuanzi Status: ready -->
<!-- EN-Revision: 64436290abce648e717ec935525b3ceef458857b Maintainer: mowangjuanzi Status: ready -->
<!-- CREDITS: Luffy -->
<refentry xml:id="function.curl-multi-remove-handle" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>curl_multi_remove_handle</refname>
<refpurpose>从一组 cURL 句柄中移除一个多句柄</refpurpose>
<refpurpose>从一组 cURL 句柄中移除一个句柄</refpurpose>
</refnamediv>

<refsect1 role="description">
Expand All @@ -15,9 +16,9 @@
<methodparam><type>CurlHandle</type><parameter>handle</parameter></methodparam>
</methodsynopsis>
<para>
从指定的 <parameter>multi_handle</parameter> 中移除指定的 <parameter>handle</parameter> 句柄。当移除 <parameter>handle</parameter>
后,在此句柄上运行 <function>curl_exec</function> 也是完全允许的。移除正在使用的 <parameter>handle</parameter>
句柄,涉及该句柄的正在进行的传输将有效停止
从给定的 <parameter>multi_handle</parameter> 中移除给定的 <parameter>handle</parameter>
当 <parameter>handle</parameter> 被移除后,再次调用 <function>curl_exec</function> 是完全合法的。
移除正在使用的 <parameter>handle</parameter> 会有效地停止涉及该句柄的传输
</para>
</refsect1>

Expand All @@ -34,7 +35,7 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
成功时返回 0,失败时返回 <constant>CURLM_XXX</constant> 错误代码中的一个。
成功时返回 0,失败时返回 <constant>CURLM_<replaceable>*</replaceable></constant> 错误代码中的一个。
</para>
</refsect1>

Expand Down
44 changes: 1 addition & 43 deletions reference/curl/functions/curl-multi-strerror.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: 011c65f4bbd961b42c795c0eaeecbf2dd751f688 Maintainer: duanxiaoqiang Status: ready -->
<!-- EN-Revision: 92226911a09278dd440b836583bf382c629cfc63 Maintainer: duanxiaoqiang Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<refentry xml:id="function.curl-multi-strerror" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
Expand Down Expand Up @@ -41,48 +41,6 @@
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>curl_multi_strerror</function> 函数的范例:</title>
<programlisting role="php">
<![CDATA[
<?php
// 创建 cURL 句柄
$ch1 = curl_init("http://example.com/");
$ch2 = curl_init("http://php.net/");
// 创建 cURL 多句柄
$mh = curl_multi_init();
// 添加句柄到多句柄
curl_multi_add_handle($mh, $ch1);
curl_multi_add_handle($mh, $ch2);
// 执行多句柄
do {
$status = curl_multi_exec($mh, $active);
if ($active) {
curl_multi_select($mh);
}
} while ($active && $status === CURLM_OK);
// 检测错误
if ($status !== CURLM_OK) {
// Display error message
echo "ERROR!\n " . curl_multi_strerror($status);
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
Expand Down
4 changes: 2 additions & 2 deletions reference/curl/functions/curl-setopt.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: 310963ad9ab1c2ca315361ff94314a21fa65f8b8 Maintainer: daijie Status: ready -->
<!-- EN-Revision: 89ae180a851621c308f0ea4604ff2e919aa57a7f Maintainer: daijie Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<refentry xml:id="function.curl-setopt" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down Expand Up @@ -30,7 +30,7 @@
<term><parameter>option</parameter></term>
<listitem>
<para>
需要设置的<literal>CURLOPT_XXX</literal>选项。
需要设置的 <constant>CURLOPT_<replaceable>*</replaceable></constant> 选项。
</para>
</listitem>
</varlistentry>
Expand Down
Loading

0 comments on commit ed35db2

Please sign in to comment.