PHP curl_version関数

PHP Calendar 参考手册PHP cURLリファレンスマニュアル

(PHP 5 >= 5.5.0)

curl_version — cURLのバージョン情報を取得する。


説明

array curl_version ([ int $age = CURLVERSION_NOW ] )

cURLのバージョン情報を返します。


パラメータ

age


戻り値

以下の要素を含む連想配列を返します:

Indice 値 説明
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がサポートするプロトコル名の配列

例

この例では、現在の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;
}
?>

PHP Calendar 参考手册PHP cURLリファレンスマニュアル

他の拡張機能