PHP 8.3.4 Released!

curl_close

(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)

curl_closecURL oturumunu sonlandırır

Açıklama

curl_close(CurlHandle $tanıtıcı): void

Bilginize:

Bu işlevin bir etkisi yoktur. PHP 8.0.0 öncesinde, bu işev özkaynağı kapatmak için kullanılırdı.

cURL oturumunu sonlandırır ve ayrılmış özkaynakları serbest bırakır. Ayrıca, cURL tanıtıcısı tanıtıcı silinir.

Bağımsız Değişkenler

tanıtıcı

curl_init() işlevinden dönen bir cURL tanıtıcısı.

Dönen Değerler

Hiçbir değer dönmez.

Sürüm Bilgisi

Sürüm: Açıklama
8.0.0tanıtıcı için artık bir CurlHandle örneği bekleniyor; evvelce, resource türünde bir değer beklenirdi.

Örnekler

Örnek 1 - Yeni bir cURL oturumunun ilklendirilmesi ve bir HTML sayfasının alınması

<?php
// Yeni bir cURL tanıtıcısı oluşturalım
$ct = curl_init();

// URL'yi ve ilgili seçenekleri belirleyelim
curl_setopt($ct, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ct, CURLOPT_HEADER, 0);

// URL'yi tarayıcıya aktaralım
curl_exec($ct);

// cURL tanıtıcısını kapatıp sistem özkaynaklarını serbest bırakalım
curl_close($ct);
?>

Ayrıca Bakınız

add a note

User Contributed Notes 1 note

up
2
JS
6 months ago
Although the Note for this call says "Prior to PHP 8.0.0, this function was used to close the resource", I found that PHP 7.4.33 on CentOS is not closing the connection on curl_close.

The workaround if you want to make sure the connection closes immediately after the request is to set the curl option to forbid reuse:

curl_setopt($curl, CURLOPT_FORBID_REUSE, TRUE);
To Top