(PHP 5 >= 5.5.0)
curl_version — 獲取CURL版本信息。
array curl_version ([ int $age = CURLVERSION_NOW ] )
返回關(guān)于CURL的版本信息。
age
返回一個相關(guān)的數(shù)組包含如下元素:
| Indice | 值描述 |
|---|---|
| version_number | CURL 24位版本號 |
| version | CURL 版本號,字符串形式 |
| ssl_version_number | OpenSSL 24 位版本號 |
| ssl_version | OpenSSL 版本號,字符串形式 |
| libz_version | zlib 版本號,字符串形式 |
| host | 關(guān)于編譯CURL主機的信息 |
| age | |
| features | 一個CURL_VERSION_XXX常量的位掩碼 |
| protocols | 一個CURL支持的協(xié)議名字的數(shù)組 |
這個范例將會檢查當(dāng)前CURL版本使用curl_version()返回的'features'位掩碼中哪些特性是可用的。
<?php
// 獲取CURL版本數(shù)組
$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;
}
?>