PHP curl_close函数

PHP 教程 · 2019-01-23 10:43:11

(PHP 4 >= 4.0.2, PHP 5)

curl_close — 关闭一个cURL会话


说明

void curl_close ( resource $ch )

关闭一个cURL会话并且释放所有资源。cURL句柄ch 也会被释放。


参数

ch

由 curl_init() 返回的 cURL 句柄。


返回值

没有返回值。


实例

初始化一个cURL会话来获取一个网页

<?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);
?>

参见

  • curl_init() - 初始化一个cURL会话
  • curl_multi_close() - 关闭一组cURL句柄

点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

The Practice of Programming

The Practice of Programming

Brian W. Kernighan、Rob Pike / Addison-Wesley / 1999-2-14 / USD 49.99

With the same insight and authority that made their book The Unix Programming Environment a classic, Brian Kernighan and Rob Pike have written The Practice of Programming to help make individual progr......一起来看看 《The Practice of Programming》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

URL 编码/解码
URL 编码/解码

URL 编码/解码