cURL curl_share_close
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
curl_share_close — cURL 공유 핸들 닫기
설명
curl_share_close(CurlShareHandle $share_handle
): void
메모: 이 함수는 효과가 없습니다. PHP 8.0.0 이전에는 이 함수를 사용하여 리소스를 닫았습니다.
cURL 공유 핸들을 닫고 모든 리소스를 해제합니다.
매개변수
share_handle
- curl_share_init()에서 반환된 cURL 공유 핸들입니다.
반환 값
값이 반환되지 않습니다.
변경 로그
버전 | 설명 |
---|---|
8.0.0 | share_handle 은 이제 CurlShareHandle 인스턴스를 예상합니다. 이전에는 리소스가 필요했습니다. |
Examples
예제 #1 curl_share_setopt() 예제
이 예에서는 cURL 공유 핸들을 만들고 여기에 두 개의 cURL 핸들을 추가한 다음 쿠키 데이터 공유와 함께 실행합니다.
<?php
// Create cURL share handle and set it to share cookie data
$sh = curl_share_init();
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
// Initialize the first cURL handle and assign the share handle to it
$ch1 = curl_init("http://example.com/");
curl_setopt($ch1, CURLOPT_SHARE, $sh);
// Execute the first cURL handle
curl_exec($ch1);
// Initialize the second cURL handle and assign the share handle to it
$ch2 = curl_init("http://php.net/");
curl_setopt($ch2, CURLOPT_SHARE, $sh);
// Execute the second cURL handle
// all cookies from $ch1 handle are shared with $ch2 handle
curl_exec($ch2);
// Close the cURL share handle
curl_share_close($sh);
// Close the cURL handles
curl_close($ch1);
curl_close($ch2);
?>
기타
- curl_share_init() - cURL 공유 핸들 초기화