导航首页 » 技术教程 » PHP:curl_reset()的用法_cURL函数
PHP:curl_reset()的用法_cURL函数 118 2023-12-17   

curl_reset

(PHP 5 >= 5.5.0)

curl_reset — Reset all options of a libcurl session handle

说明

void curl_reset ( resource $ch )

This function re-initializes all options set on the given cURL handle to the default values.

参数

ch

由 curl_init() 返回的 cURL 句柄。

返回值

没有返回值。

范例

Example #1 curl_reset() example

<?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);
?>

注释

Note:

curl_reset() also resets the URL given as the curl_init() parameter.

参见

curl_setopt() - 设置一个cURL传输选项



!!!站长长期在线接!!!

网站、小程序:定制开发/二次开发/仿制开发等

各种疑难杂症解决/定制接口/定制采集等

站长微信:lxwl520520

站长QQ:1737366103