curl_version
(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)
curl_version — 获取 cURL 版本信息
说明
curl_version(int
$age
= CURLVERSION_NOW): array返回关于 cURL 版本的信息。
参数
-
age
-
返回值
返回关联数组,包含如下元素:
键 | 值描述 |
---|---|
version_number | cURL 24 位版本号 |
version | cURL 版本号,字符串形式 |
ssl_version_number | OpenSSL 24 位版本号 |
ssl_version | OpenSSL 版本号,字符串形式 |
libz_version | zlib 版本号,字符串形式 |
host | 关于编译cURL主机的信息 |
age | |
features | 一个CURL_VERSION_XXX 常量的位掩码 |
protocols | 数组,包含 cURL 支持的协议名称 |
范例
示例 #1 curl_version() 例子
这个范例将会检查当前 cURL 版本使用curl_version()返回的 'features' 位掩码中哪些特性是可用的。
<?php
// 获取cURL版本数组
$version = curl_version();
// 在cURL编译版本中使用位域来检查某些特性
$bitfields = Array(
'CURL_VERSION_IPV6',
'CURL_VERSION_KERBEROS4',
'CURL_VERSION_SSL',
'CURL_VERSION_LIBZ'
);
foreach($bitfields as $feature)
{
echo $feature . ($version['features'] & constant($feature) ? ' matches' : ' does not match');
echo PHP_EOL;
}
?>

User Contributed Notes
There are no user contributed notes for this page.
备份地址:http://www.lvesu.com/blog/php/function.curl-version.php