curl_multi_close
curl_multi_close
(PHP 5, PHP 7)
curl_multi_close - 关闭一组cURL句柄
描述
void curl_multi_close ( resource $mh )
关闭一组cURL手柄。
参数
mh
由curl_multi_init()返回的cURL多重句柄。
返回值
没有值返回。
例子
Example #1 curl
_
multi
_
close() example
这个例子将创建两个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
$running=null;
//execute the handles
do {
curl_multi_exec($mh,$running
} while ($running > 0
//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
?>
← curl_multi_add_handle
curl_multi_errno →