difference between executing curl_close() once or frequently?

前端 未结 3 1601
别那么骄傲
别那么骄傲 2021-01-17 16:37

When is it necessary to close curl connection and release resources consumed by it?

Why do I ask this question, well quite simply because I was told, that PHP garbag

3条回答
  •  无人及你
    2021-01-17 17:22

    Depends. In my case since I was initializing curl instance in my custom CurlClient constructor

    $this->ch = curl_init();
    

    And then using same $curlClient object for multiple api calls, closing the instance

    curl_close($this->ch);
    

    would affect other API calls. Methods using the same object will not work, so I'm not closing it.

提交回复
热议问题