PHP curl_share_init函数
PHP 教程
· 2019-01-23 16:42:54
(PHP 5 >= 5.5.0)
curl_share_init — 初始化一个 cURL 共享句柄
说明
resource curl_share_init ( void )
允许两个 cURL 句柄分享数据。
参数
此函数没有参数。
返回值
返回"cURL共享句柄"的资源。
实例
该实例将创建一个cURL共享句柄,并添加两个 cURL 句柄,两个句柄共享cookie数据。
<?php
// 创建cURL共享句柄并设置cookie数据
$sh = curl_share_init();
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
// 初始化第一个cURL句柄并指定它为共享句柄
$ch1 = curl_init("http://www.w3cschool.cc/");
curl_setopt($ch1, CURLOPT_SHARE, $sh);
// 执行第一个cURL句柄
curl_exec($ch1);
// 初始化第二个cURL句柄并指定它为共享句柄
$ch2 = curl_init("http://php.net/");
curl_setopt($ch2, CURLOPT_SHARE, $sh);
// 执行第二个cURL句柄
// 所有 $ch1 句柄的数据在 $ch2 句柄中共享
curl_exec($ch2);
// 关闭cURL共享句柄
curl_share_close($sh);
// 关闭cURL句柄
curl_close($ch1);
curl_close($ch2);
?>
点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html
Pattern Recognition and Machine Learning
Christopher Bishop / Springer / 2007-10-1 / USD 94.95
The dramatic growth in practical applications for machine learning over the last ten years has been accompanied by many important developments in the underlying algorithms and techniques. For example,......一起来看看 《Pattern Recognition and Machine Learning》 这本书的介绍吧!