array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.curl-multi-strerror.php', 1 => 'curl_multi_strerror', ), 'up' => array ( 0 => 'ref.curl.php', 1 => 'cURL 函数', ), 'prev' => array ( 0 => 'function.curl-multi-setopt.php', 1 => 'curl_multi_setopt', ), 'next' => array ( 0 => 'function.curl-pause.php', 1 => 'curl_pause', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/curl/functions/curl-multi-strerror.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
curl_multi_strerror — 返回字符串描述的错误代码
error_code
» CURLM 错误代码中的常量之一。
返回可用错误代码所对应的错误信息,否则返回 null
。
示例 #1 curl_multi_strerror() 函数的范例:
<?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);
}
?>