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

curl_reset

(PHP 5 >= 5.5.0, PHP 7)

curl_reset - 重置libcurl会话句柄的所有选项

描述

代码语言:javascript
复制
void curl_reset ( resource $ch )

此函数将给定cURL句柄上设置的所有选项重新初始化为默认值。

参数

ch

由curl_init()返回的cURL句柄。

返回值

没有值返回。

例子

Example #1 curl_reset() example

代码语言:javascript
复制
<?php
// Create a curl handle
$ch = curl_init();

// Set CURLOPT_USERAGENT option
curl_setopt($ch, CURLOPT_USERAGENT, "My test user-agent");

// Reset all previously set options
curl_reset($ch);

// Send HTTP request
curl_setopt($ch, CURLOPT_URL, 'http://example.com/');
curl_exec($ch); // the previously set user-agent will be not sent, it has been reset by curl_reset

// Close the handle
curl_close($ch);
?>

注释

注意curl_reset()也会重置作为curl_init()参数给出的URL。

← curl_pause

curl_setopt_array →

扫码关注腾讯云开发者

领取腾讯云代金券