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

查看所有标签

Real-Time Collision Detection

Real-Time Collision Detection

Christer Ericson / CRC Press / 2004-12-22 / USD 98.95

Written by an expert in the game industry, Christer Ericson's new book is a comprehensive guide to the components of efficient real-time collision detection systems. The book provides the tools and kn......一起来看看 《Real-Time Collision Detection》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

SHA 加密
SHA 加密

SHA 加密工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器