/** * 初始化 */ function __construct() { if (HttpClient::is_support_curl()) { $this->type = HttpClient::TYPE_CURL; } else { $this->type = HttpClient::TYPE_FSOCK; } }
/** * @param string $type 指定驱动类型 */ function __construct($type = null) { if ($type) { $this->type = $type; } elseif (HttpClient::$default_type) { $this->type = HttpClient::$default_type; } elseif (HttpClient::is_support_curl()) { $this->type = HttpClient::TYPE_CURL; } else { $this->type = HttpClient::TYPE_Fsock; } }