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
Head First HTML and CSS
Elisabeth Robson、Eric Freeman / O'Reilly Media / 2012-9-8 / USD 39.99
Tired of reading HTML books that only make sense after you're an expert? Then it's about time you picked up Head First HTML and really learned HTML. You want to learn HTML so you can finally create th......一起来看看 《Head First HTML and CSS》 这本书的介绍吧!