PHP curl_strerror函数

PHP 教程 · 2019-01-23 17:13:05

(PHP 5 >= 5.5.0)

curl_strerror — 返回错误码的描述。

说明

string curl_strerror ( int $errornum )

返回错误码的文本描述信息。

参数

errornum

一个 » cURL 错误码的常量。

返回值

返回错误码描述信息,非法错误码返回NULL 。

实例

<?php
// 创建一个拼写错误的URL的cURL句柄
$ch = curl_init("htp://example.com/");

// 发送请求
curl_exec($ch);

// 检查错误代码并显示错误信息
if($errno = curl_errno($ch)) {
    $error_message = curl_strerror($errno);
    echo "cURL error ({$errno}):\n {$error_message}";
}

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

以上例程会输出:

cURL error (1):
 Unsupported protocol
 

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

查看所有标签

Database Design and Implementation

Database Design and Implementation

Edward Sciore / Wiley / 2008-10-24 / 1261.00 元

* Covering the traditional database system concepts from a systems perspective, this book addresses the functionality that database systems provide as well as what algorithms and design decisions will......一起来看看 《Database Design and Implementation》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具