返回字串描述的錯誤程式碼

curl_multi_strerror

(PHP 5 >= 5.5.0, PHP 7, PHP 8)

curl_multi_strerror — 返回字串描述的錯誤程式碼

說明

curl_multi_strerror(int $errornum): string

返回一個用以描述所給 CURLM 錯誤程式碼所對應的錯誤資訊。

參數

errornum

» CURLM 錯誤程式碼中的常量之一。

返回值

返回可用錯誤程式碼所對應的錯誤資訊,否則返回 null 。

範例

示例 #1 curl_multi_strerror() 函式的範例:

<?php
// Create cURL handles
$ch1 = curl_init("http://example.com"/);
$ch2 = curl_init("http://php.net/");

// Create a cURL multi handle
$mh = curl_multi_init();

// Add the handles to the multi handle
curl_multi_add_handle($mh, $ch1);
curl_multi_add_handle($mh, $ch2);

// Execute the multi handle
do {
    
$status = curl_multi_exec($mh, $active);
    
// Check for errors
    
if($status > 0) {
        
// Display error message
        
echo "ERROR!\n " . curl_multi_strerror($status);
    }
} while (
$status === CURLM_CALL_MULTI_PERFORM || $active);
?>

參見

Leave a Reply

Your email address will not be published. Required fields are marked *