<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.curl.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.curl-share-close.php',
    1 => 'curl_share_close',
    2 => '关闭 cURL 共享句柄',
  ),
  'up' => 
  array (
    0 => 'ref.curl.php',
    1 => 'cURL 函数',
  ),
  'prev' => 
  array (
    0 => 'function.curl-setopt-array.php',
    1 => 'curl_setopt_array',
  ),
  'next' => 
  array (
    0 => 'function.curl-share-errno.php',
    1 => 'curl_share_errno',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/curl/functions/curl-share-close.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.curl-share-close" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">curl_share_close</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.5.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">curl_share_close</span> &mdash; <span class="dc-title">关闭 cURL 共享句柄</span></p>

 </div>

 <div id="function.curl-share-close-refsynopsisdiv">
  <div class="warning"><strong class="warning">警告</strong><p class="simpara">此函数自 PHP 8.5.0
起<em>弃用</em>。强烈建议不要应用此函数。</p></div>
 </div>

 <div class="refsect1 description" id="refsect1-function.curl-share-close-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="attribute"><a href="class.deprecated.php">#[\Deprecated]</a> </span><br>
   <span class="methodname"><strong>curl_share_close</strong></span>(<span class="methodparam"><span class="type"><a href="class.curlsharehandle.php" class="type CurlShareHandle">CurlShareHandle</a></span> <code class="parameter">$share_handle</code></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

  <blockquote class="note"><p><strong class="note">注意</strong>: 
 <p class="para">
  此函数无效。在 PHP 8.0.0 之前，用于关闭资源。
 </p>
</p></blockquote>

  <p class="para">
   关闭 cURL 共享句柄并且释放所有的资源。
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.curl-share-close-parameters">
  <h3 class="title">参数</h3>
  <dl>
   <dt><code class="parameter">share_handle</code>
</dt><dd><p class="para">A cURL share handle returned by
<span class="function"><a href="function.curl-share-init.php" class="function">curl_share_init()</a></span>.</p></dd>
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.curl-share-close-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>

 
 <div class="refsect1 changelog" id="refsect1-function.curl-share-close-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.0.0</td>
 <td>
  <code class="parameter">share_handle</code> expects a <span class="classname"><a href="class.curlsharehandle.php" class="classname">CurlShareHandle</a></span>
  instance now; previously, a <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> was expected.
 </td>
</tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.curl-share-close-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 <span class="function"><a href="function.curl-share-setopt.php" class="function">curl_share_setopt()</a></span> 示例</strong></p>
    <div class="example-contents"><p>
     以下示例将会创建 cURL 共享句柄，并且往其中添加两个 cURL 句柄，最后共享这两个 cURL 句柄的 cookie 数据运行。
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// Create cURL share handle and set it to share cookie data<br /></span><span style="color: #0000BB">$sh </span><span style="color: #007700">= </span><span style="color: #0000BB">curl_share_init</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">curl_share_setopt</span><span style="color: #007700">(</span><span style="color: #0000BB">$sh</span><span style="color: #007700">, </span><span style="color: #0000BB">CURLSHOPT_SHARE</span><span style="color: #007700">, </span><span style="color: #0000BB">CURL_LOCK_DATA_COOKIE</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Initialize the first cURL handle and assign the share handle to it<br /></span><span style="color: #0000BB">$ch1 </span><span style="color: #007700">= </span><span style="color: #0000BB">curl_init</span><span style="color: #007700">(</span><span style="color: #DD0000">"http://example.com/"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">curl_setopt</span><span style="color: #007700">(</span><span style="color: #0000BB">$ch1</span><span style="color: #007700">, </span><span style="color: #0000BB">CURLOPT_SHARE</span><span style="color: #007700">, </span><span style="color: #0000BB">$sh</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Execute the first cURL handle<br /></span><span style="color: #0000BB">curl_exec</span><span style="color: #007700">(</span><span style="color: #0000BB">$ch1</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Initialize the second cURL handle and assign the share handle to it<br /></span><span style="color: #0000BB">$ch2 </span><span style="color: #007700">= </span><span style="color: #0000BB">curl_init</span><span style="color: #007700">(</span><span style="color: #DD0000">"http://php.net/"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">curl_setopt</span><span style="color: #007700">(</span><span style="color: #0000BB">$ch2</span><span style="color: #007700">, </span><span style="color: #0000BB">CURLOPT_SHARE</span><span style="color: #007700">, </span><span style="color: #0000BB">$sh</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Execute the second cURL handle<br />//  all cookies from $ch1 handle are shared with $ch2 handle<br /></span><span style="color: #0000BB">curl_exec</span><span style="color: #007700">(</span><span style="color: #0000BB">$ch2</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Close the cURL share handle<br /></span><span style="color: #0000BB">curl_share_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$sh</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-function.curl-share-close-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.curl-share-init.php" class="function" rel="rdfs-seeAlso">curl_share_init()</a> - 初始化 cURL 共享句柄</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>