PHP curl_error函数

PHP 教程 · 2019-01-23 11:27:47

(PHP 4 >= 4.0.3, PHP 5)

curl_error — 返回一个保护当前会话最近一次错误的字符串

说明

string curl_error ( resource $ch )

返回一条最近一次cURL操作明确的文本的错误信息。

参数

ch

由 curl_init() 返回的 cURL 句柄。

返回值

返回错误信息或 '' (空字符串) 如果没有任何错误发生。

实例

<?php
// 创建一个指向一个不存在的位置的cURL句柄
$ch = curl_init('http://404.php.net/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

if(curl_exec($ch) === false)
{
    echo 'Curl error: ' . curl_error($ch);
}
else
{
    echo '操作完成没有任何错误';
}

// 关闭句柄
curl_close($ch);
?>

参见

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

查看所有标签

We Are the Nerds

We Are the Nerds

Christine Lagorio-Chafkin / Hachette Books / 2018-10-2 / USD 18.30

Reddit hails itself as "the front page of the Internet." It's the third most-visited website in the United States--and yet, millions of Americans have no idea what it is. We Are the Nerds is an eng......一起来看看 《We Are the Nerds》 这本书的介绍吧!

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具