PHP curl_errno函数

PHP 教程 · 2019-01-23 11:13:16

(PHP 4 >= 4.0.3, PHP 5)

curl_errno — 返回最后一次的错误号

说明

int curl_errno ( resource $ch )

返回最后一次cURL操作的错误号。

参数

ch

由 curl_init() 返回的 cURL 句柄。

返回值

返回错误号或 0 (零) 如果没有错误发生。

实例


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

// 执行
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);

// 检查是否有错误发生
if(curl_errno($ch))
{
    echo 'Curl error: ' . curl_error($ch);
}

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

参见

  • curl_error() - 返回一个保护当前会话最近一次错误的字符串
  • » Curl 错误号

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

查看所有标签

Programming Python

Programming Python

Mark Lutz / O'Reilly Media / 2006-8-30 / USD 59.99

Already the industry standard for Python users, "Programming Python" from O'Reilly just got even better. This third edition has been updated to reflect current best practices and the abundance of chan......一起来看看 《Programming Python》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具