curl_reset

(PHP 5 >= 5.5.0, PHP 7)

curl_reset锟斤拷锟斤拷一锟斤拷 libcurl 锟结话锟斤拷锟斤拷锟斤拷锟斤拷械锟窖★拷锟�

说锟斤拷

curl_reset ( resource $ch ) : void

锟矫猴拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 cURL 锟斤拷锟斤拷锟斤拷锟窖★拷锟斤拷锟斤拷锟斤拷锟斤拷锟轿拷锟街碉拷锟�

锟斤拷锟斤拷

ch

锟斤拷 curl_init() 锟斤拷锟截碉拷 cURL 锟斤拷锟斤拷锟�

锟斤拷锟斤拷值

没锟叫凤拷锟斤拷值锟斤拷

锟斤拷锟斤拷

Example #1 curl_reset() 示锟斤拷

<?php
// 锟斤拷锟斤拷一锟斤拷url 锟斤拷锟�
$ch curl_init();

// 锟斤拷锟斤拷 CURLOPT_USERAGENT 选锟斤拷
curl_setopt($chCURLOPT_USERAGENT"My test user-agent");

// 锟斤拷锟斤拷锟斤拷锟叫碉拷预锟斤拷锟斤拷锟矫碉拷选锟斤拷
curl_reset($ch);

// 锟斤拷锟斤拷 HTTP 锟斤拷锟斤拷
curl_setopt($chCURLOPT_URL'http://example.com/');
curl_exec($ch); // 预锟斤拷锟斤拷锟矫碉拷 user-agent 锟斤拷锟结被锟斤拷锟酵o拷锟斤拷锟窖撅拷锟斤拷 curl_reset 锟斤拷锟矫碉拷锟斤拷

// 锟截闭撅拷锟�
curl_close($ch);
?>

注锟斤拷

Note:

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

锟轿硷拷

  • curl_setopt() - 锟斤拷锟斤拷 cURL 锟斤拷锟斤拷选锟斤拷