Home > Article > Backend Development > How to close php curl
In PHP, you can close a cURL session through the "curl_close" method. The syntax is "void curl_close (resource $ch)". This statement can close a cURL session and release all resources, where the cURL handle ch will also be released.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
curl_close — Close a cURL session
Description
void curl_close ( resource $ch )
Close a cURL session and release all resources. The cURL handle ch will also be released.
Parameters
ch
The cURL handle returned by curl_init().
Return value
No return value.
Example
Initialize a cURL session to obtain a web page
<?php // 创建一个新cURL资源 $ch = curl_init(); // 设置URL和相应的选项 curl_setopt($ch, CURLOPT_URL, "http://www.w3cschool.cc/"); curl_setopt($ch, CURLOPT_HEADER, 0); // 抓取URL并把它传递给浏览器 curl_exec($ch); // 关闭cURL资源,并且释放系统资源 curl_close($ch); ?>
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to close php curl. For more information, please follow other related articles on the PHP Chinese website!