cURL curl_multi_close

(PHP 5, PHP 7, PHP 8)

curl_multi_close — cURL 핸들 세트 닫기


설명

curl_multi_close(CurlMultiHandle $multi_handle): void

메모: 이 함수는 효과가 없습니다. PHP 8.0.0 이전에는 이 함수를 사용하여 리소스를 닫았습니다.

cURL 핸들 세트를 닫습니다.


매개변수

multi_handle
curl_multi_init()에서 반환된 cURL 다중 핸들입니다.

반환 값

값이 반환되지 않습니다.


변경 로그

버전 설명
8.0.0 multi_handle은 이제 CurlMultiHandle 인스턴스를 예상합니다. 이전에는 리소스가 필요했습니다.

Examples

예제 #1 curl_multi_close() 예제

이 예제는 두 개의 cURL 핸들을 생성하여 다중 핸들에 추가하고 비동기적으로 처리합니다.

                  
<?php
// create both cURL resources
$ch1 = curl_init();
$ch2 = curl_init();

// set URL and other appropriate options
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);

//create the multiple cURL handle
$mh = curl_multi_init();

//add the two handles
curl_multi_add_handle($mh,$ch1);
curl_multi_add_handle($mh,$ch2);

//execute the multi handle
do {
    $status = curl_multi_exec($mh, $active);
    if ($active) {
        curl_multi_select($mh);
    }
} while ($active && $status == CURLM_OK);

//close the handles
curl_multi_remove_handle($mh, $ch1);
curl_close($ch1);
curl_multi_remove_handle($mh, $ch2);
curl_close($ch2);
curl_multi_close($mh);

?>
                  
                

기타