首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

curl_multi_close

(PHP 5, PHP 7)

curl_multi_close - 关闭一组cURL句柄

描述

代码语言:javascript
复制
void curl_multi_close ( resource $mh )

关闭一组cURL手柄。

参数

mh

由curl_multi_init()返回的cURL多重句柄。

返回值

没有值返回。

例子

Example #1 curl_multi_close() example

这个例子将创建两个cURL句柄,将它们添加到一个多句柄,并异步处理它们。

代码语言:javascript
复制
<?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 →

扫码关注腾讯云开发者

领取腾讯云代金券