成人精品一区二区三区中文字幕-成人精品一区二区三区-成人精品一级毛片-成人精品亚洲-日本在线视频一区二区-日本在线视频免费

導航首頁 ? 技術教程 ? PHP:curl_share_setopt()的用法_cURL函數
全站頭部文字 我要出現在這里
PHP:curl_share_setopt()的用法_cURL函數 767 2023-12-17   

curl_share_setopt

(PHP 5 >= 5.5.0)

curl_share_setopt — Set an option for a cURL share handle.

說明

bool curl_share_setopt ( resource $sh , int $option , string $value )

Sets an option on the given cURL share handle.

參數

sh

A cURL share handle returned by curl_share_init().

option

Option Description CURLSHOPT_SHARE Specifies a type of data that should be shared. CURLSHOPT_UNSHARE Specifies a type of data that will be no longer shared.

value

Value Description CURL_LOCK_DATA_COOKIE Shares cookie data. CURL_LOCK_DATA_DNS Shares DNS cache. Note that when you use cURL multi handles, all handles added to the same multi handle will share DNS cache by default. CURL_LOCK_DATA_SSL_SESSION Shares SSL session IDs, reducing the time spent on the SSL handshake when reconnecting to the same server. Note that SSL session IDs are reused withing the same handle by default.

返回值

成功時返回 TRUE, 或者在失敗時返回 FALSE

范例

Example #1 curl_share_setopt() example

This example will create a cURL share handle, add two cURL handles to it, and then run them with cookie data sharing.

<?php
// Create cURL share handle and set it to share cookie data
$sh = curl_share_init();
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);

// Initialize the first cURL handle and assign the share handle to it
$ch1 = curl_init("http://example.com/");
curl_setopt($ch1, CURLOPT_SHARE, $sh);

// Execute the first cURL handle
curl_exec($ch1);

// Initialize the second cURL handle and assign the share handle to it
$ch2 = curl_init("http://php.net/");
curl_setopt($ch2, CURLOPT_SHARE, $sh);

// Execute the second cURL handle
//  all cookies from $ch1 handle are shared with $ch2 handle
curl_exec($ch2);

// Close the cURL share handle
curl_share_close($sh);

// Close the cURL handles
curl_close($ch1);
curl_close($ch2);
?>



主站蜘蛛池模板: 国产高清一卡2卡3卡4卡乱码| 地下道的美人鱼| 男人天堂视频| 面部八大皱纹图| 邵雨薇电影| 龙政璇| 变形金刚1原版免费观看| 地理填充图册| 俺去也电影网| 永远是少年电影免费观看| 《最后的凶手》免费观看| 小敏家| 相识电影| 莴笋是发物吗| 热血街区| 魔法城堡歌词| 丘淑贞| 想要更多| 笼中女电影| 美女又黄又免费的视频| be小说| 庆余年2豆瓣| 消防给水及消火栓系统技术规范 | 电视剧瞧这一家子演员表| 新闻女郎| 昵称大全2024最新版| 石璐| 叶子楣代表咋| 时来运转电影| 金三角电影| 日本电影芋虫| 《人奶魔劫》电影在线播放| 新成长的烦恼| 辰巳ゆい| 老牛家的战争电视剧全集免费观看 | 大太监李莲英| 韩剧上流社会| jar of love完整版| 玛雅历险记| 巴霍巴利王2国语版在线观看免费 惊弦电视剧完整版免费观看高清 梦的衣裳 | 人世间豆瓣|

!!!站長長期在線接!!!

網站、小程序:定制開發(fā)/二次開發(fā)/仿制開發(fā)等

各種疑難雜癥解決/定制接口/定制采集等

站長微信:lxwl520520

站長QQ:1737366103