Requests_Proxy_HTTP::__construct()

最后更新于:2021-12-01 11:09:27

Requests_Proxy_( array|null$args=null)

Constructor

参数

$args

(array|null) (Optional) Array of user and password. Must have exactly two elements

Default value: null

源文件

文件: gc-includes/Requests/Proxy/HTTP.php

	public function __construct($args = null) {
		if (is_string($args)) {
			$this->proxy = $args;
		}
		elseif (is_array($args)) {
			if (count($args) === 1) {
				list($this->proxy) = $args;
			}
			elseif (count($args) === 3) {
				list($this->proxy, $this->user, $this->pass) = $args;
				$this->use_authentication                    = true;
			}
			else {
				throw new Requests_Exception('Invalid number of arguments', 'proxyhttpbadargs');
			}
		}
	}