curl-version
curl_version
Gets cURL version information
ENTITY
array
false
curl_version
Returns information about the cURL version.
ENTITY ENTITY
ENTITY
Returns an associative array with the following elements:
| Key | Value description |
|---|---|
| version_number | cURL 24 bit version number |
| version | cURL version number, as a string |
| ssl_version_number | Always 0, libcurl does not set it anymore |
| ssl_version | OpenSSL version number, as a string |
| libz_version | zlib version number, as a string |
| host | Information about the host where cURL was built |
| age | The age of the version info returned by libcurl. Newer libcurl versions have a higher age |
| features | A bitmask of the CURL_VERSION_* constants |
| protocols | An array of protocols names supported by cURL |
| feature_list | An associative array of all known cURL features, and whether they are supported (ENTITY) or not (ENTITY) |
| ares | c-ares version, as a string, or an empty string if cURL was built without c-ares |
| ares_num | c-ares version number, or 0 if cURL was built without c-ares |
| libidn | libidn2 version, as a string, or an empty string if cURL was built without libidn2 |
| iconv_ver_num | iconv version number, or 0 if cURL was built without iconv |
| libssh_version | SSH library name and version, as a string, or an empty string if cURL was built without SSH support |
| brotli_ver_num | Brotli version number, or 0 if cURL was built without Brotli |
| brotli_version | Brotli version, as a string, or an empty string if cURL was built without Brotli |
ENTITY
| ENTITY | ENTITY |
|---|---|
| 8.4.0 | feature_list added. |
| 8.0.0 | The optional age parameter has been removed. |
| 7.4.0 | The optional age parameter has been deprecated; if a value is passed, it is ignored. |
ENTITY
curl_version example
This example will check which features are available in the cURL build by using the 'features' bitmask returned by curl_version.
<?php
// Get curl version array
$version = curl_version();
// These are the bitfields that can be used
// to check for features in the curl build
$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;
}
?>
这篇文档对你有帮助吗?
谢谢你的反馈!