GET请求数据.

@param string      $url   URL.
@param string|null $base  基础目录
@param bool        $re    重用
@param bool        $isImg 是否是图片

@return bool|mixed|null|string|string[]
169908
public function get($url, $base = null, $re = false, $isImg = false) {
        set_time_limit(0);
        if ($base) {
            $uinfo = CurlClient::getUrlInfo($url);
            if ($uinfo ['root'] != $this->domain) {
                $ip = rtrim($base, DS) . DS . 'o_tfs' . DS . ($uinfo ['path'] ? $uinfo ['path'] . DS : '');
            } else {
                $ip = rtrim($base, DS) . DS . ($uinfo ['path'] ? $uinfo ['path'] . DS : '');
            }

            if (!file_exists($ip)) {
                if (!@mkdir($ip, 0777, true)) {
                    return false;
                }
            }

            $tmpName = $ip . $uinfo ['file'];
            if (file_exists($tmpName)) {
                if ($re) {
                    return @file_get_contents($tmpName);
                } else {
                    return true;
                }
            }
        }
        $curl = $this->ch;
        curl_setopt($curl, CURLOPT_URL, $url);
        $rst = curl_exec($curl);
        if ($rst === false) {
            $this->error     = curl_error($this->ch);
            $this->errorCode = '500';
            $rst             = false;
        } else {
            $code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
            if ($code != '200') {
                $this->error     = '[' . $code . ']' . get_status_header_desc($code);
                $this->errorCode = $code;
                $rst             = false;
            }
        }
        if ($rst) {
            if (!$isImg && $this->encoding != 'UTF-8') {
                $rst = CurlClient::convertString($rst, $this->encoding);
            }
            if (isset ($tmpName)) {
                if (!@file_put_contents($tmpName, $rst)) {
                    return false;
                }
            }
        }

        return $rst;
    }
401904
public static function tryParseRelative(string $url, UrlInterface $baseUrl): ?UrlInterface
    {
        try {
            if (!self::myParse($baseUrl, $url, $scheme, $host, $port, $path, $queryString, $fragment)) {
                return null;
            }
        } catch (UrlPathLogicException $exception) {
            return null;
        }

        return new self($scheme, $host, $port, $path, $queryString, $fragment);
    }
687435
public static function getRepositoryByUrl($url)
	{
		$remoteRepos = self::_getRemoteRepositories();
		foreach ($remoteRepos as $repo)
		{
			$config = $repo->getRepoConfig();
			if ($config['url'] == $url)
			{
				return $repo;
			}
		}
		return null;
	}
868365
private function checkUrlBind($url)
    {
        $bind = $this->router->getBind($this->domain);

        if (!empty($bind)) {
            $this->parseBindAppendParam($bind);

            // 记录绑定信息
            Container::get('app')->log('[ BIND ] ' . var_export($bind, true));

            // 如果有URL绑定 则进行绑定检测
            $type = substr($bind, 0, 1);
            $bind = substr($bind, 1);

            $bindTo = [
                '\\' => 'bindToClass',
                '@'  => 'bindToController',
                ':'  => 'bindToNamespace',
            ];

            if (isset($bindTo[$type])) {
                return $this->{$bindTo[$type]}($url, $bind);
            }
        }

        return false;
    }
848590
public function getRetry(
        string $url,
        string $method
    ): ? Retry {
        $url = trim(trim(strtolower($url)), '/');
        $method = trim(strtolower($method));

        if (isset($this->retries[$url.'~~'.$method])) {
            return $this->retries[$url.'~~'.$method];
        }

        if (isset($this->retries['*~~'.$method])) {
            return $this->retries['*~~'.$method];
        }

        if (isset($this->retries[$url.'~~*'])) {
            return $this->retries[$url.'~~*'];
        }

        if (isset($this->retries['*~~*'])) {
            return $this->retries['*~~*'];
        }

        return null;
    }
285457
public function getJson($url, $params = [])
    {
        $req = $this->buildRequest('GET', $url, $params);
        $req->setHeader('accept', 'application/json');
        $res = $this->exec($req);
        return $res === false ? false : $res->getJson();
    }
310326
public function baseUrl($url = null)
    {
        if (!is_null($url) && true !== $url) {
            $this->baseUrl = $url;
            return $this;
        } elseif (!$this->baseUrl) {
            $str           = $this->url();
            $this->baseUrl = strpos($str, '?') ? strstr($str, '?', true) : $str;
        }
        return true === $url ? $this->domain() . $this->baseUrl : $this->baseUrl;
    }
442424
protected function strip_base_url($url) {
        if (substr($url, 0, strlen($this->baseUrl)) == $this->baseUrl) {
            return substr($url, strlen($this->baseUrl));
        }
        return null;
    }
300017
public function getURL(): ?string
    {
        if ($this->base !== null) {
            $list = [];
            $queryList = $this->query->getList();
            foreach ($queryList as $queryItem) {
                $list[$queryItem->name] = $queryItem->value;
            }
            return $this->base . implode('/', array_map('urlencode', explode('/', (string) $this->path))) . (empty($list) ? '' : '?' . http_build_query($list));
        }
        return null;
    }
870660
private function makeAbsoluteStr($base, $url)
    {
        if (!$url) {
            return false;
        }

        if (preg_match('!^https?://!i', $url)) {
            // already absolute
            return $url;
        }

        $base = new \SimplePie_IRI($base);

        // remove '//' in URL path (causes URLs not to resolve properly)
        if (isset($base->ipath)) {
            $base->ipath = preg_replace('!//+!', '/', $base->ipath);
        }

        if ($absolute = \SimplePie_IRI::absolutize($base, $url)) {
            return $absolute->get_uri();
        }

        return false;
    }
591794
public function getStaticUrl($sStdUrl, $iLang = null, $iShopId = null)
    {
        if (!isset($iShopId)) {
            $iShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
        }
        if (!isset($iLang)) {
            $iLang = \OxidEsales\Eshop\Core\Registry::getLang()->getEditLanguage();
        }

        if (isset($this->_aStaticUrlCache[$sStdUrl][$iLang][$iShopId])) {
            return $this->_aStaticUrlCache[$sStdUrl][$iLang][$iShopId];
        }

        $sFullUrl = '';
        if (($sSeoUrl = $this->_getStaticUri($sStdUrl, $iShopId, $iLang))) {
            $sFullUrl = $this->_getFullUrl($sSeoUrl, $iLang, strpos($sStdUrl, "https:") === 0);
        }


        $this->_aStaticUrlCache[$sStdUrl][$iLang][$iShopId] = $sFullUrl;

        return $sFullUrl;
    }
217596
public static function abs_url($url, $base)
    {
        if (!self::is_url_path($url)) {
            $t = is_array($base) ? $base : parse_url($base);
            if (strncmp($url, '//', 2) == 0) {
                if (!empty($t['scheme'])) {
                    $url = $t['scheme'] . ':' . $url;
                }
            } else {
                $base = (empty($t['scheme']) ? '//' : $t['scheme'] . '://') .
                    $t['host'] . (empty($t['port']) ? '' : ':' . $t['port']);
                if (!empty($t['path'])) {
                    $s = dirname($t['path'] . 'f');
                    if (DIRECTORY_SEPARATOR != '/') {
                        $s = strtr($s, DIRECTORY_SEPARATOR, '/');
                    }
                    if ($s && '.' !== $s && '/' !== $s && substr($url, 0, 1) !== '/') {
                        $base .= '/' . ltrim($s, '/');
                    }
                }
                $url = rtrim($base, '/') . '/' . ltrim($url, '/');
            }
        } else {
            $p = strpos($url, ':');
            if (substr($url, $p + 3, 1) === '/' && in_array(substr($url, 0, $p), array('http', 'https'))) {
                $url = substr($url, 0, $p + 3) . ltrim(substr($url, $p + 3), '/');
            }
        }
        return $url;
    }
865368
static public function getRootUrl($url=null)
	{
	    if (!$url || strpos($url, '://') === false) {
            $schema = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https://' : 'http://';
            $domain = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : getenv('HTTP_HOST');
            $domain = static::GetRootDomain($domain);
            $baseUrl = $domain ? $schema . $domain : '';
            $port = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : null;
	    } else {
	        $parts = parse_url($url);
	        $domain = static::GetRootDomain($parts['host']);
	        $baseUrl = $parts['scheme'] . '://' . $domain;
	        $port = isset($parts['port']) ? $parts['port'] : '';
	    }
	    if ($port && $port != 80 && $port != 443) {
	        $baseUrl .= ':'.$port;
	    }
	    
	    return $baseUrl;
	}
922780
public function get($url = null, $requestBody = null)
    {
        if(!empty($requestBody))
        {
            if(strpos($url, '?'))
            {
                $url .= '&';
            }
            else
            {
                $url .= '?';
            }
            $url .= http_build_query($requestBody, '', '&');
        }
        return $this->send($url, array(), 'GET');
    }
1062904
public function url($url, $params = [])
    {
        if (filter_var($url, FILTER_VALIDATE_URL)) {
            return $url;
        }
        $url = '/' . ltrim($url, '/');
        $baseUrl = "";
        if ($this->cacheBaseurl === null) {
            $vitex = Vitex::getInstance();
            $baseUrl = $vitex->getConfig('baseurl');
        }
        $qs = http_build_query($params);
        return rtrim($baseUrl, '/') . $url . ($params ? '?' . $qs : '');
    }
1098227
public function check($url, $must = false)
    {
        // 自动检测域名路由
        $domain = $this->checkDomain();

        $url = str_replace($this->config['app.pathinfo_depr'], '|', $url);

        $completeMatch = $this->config['app.route_complete_match'];

        $result = $domain->check($url, $completeMatch);

        if ($result) {
            $re =  array_merge($result, ['is_route' => true]);
            return $re;
        } elseif ($must) {
            // 强制路由不匹配则抛出异常
            throw new NotFoundHttpException('强制路由,不匹配');
        } else {
            // 检测跨域路由
//            if (!empty($this->cross)) {
//                $result = $this->cross->check($this->request, $url, $completeMatch);
//            }
//
//            if (false !== $result) {
//                // 路由匹配
//                return $result;
//            }

            // 默认路由解析
            $re = new UrlDispatch($this->group, $url, [
                'auto_search' => $this->autoSearchController,
            ]);

            return array_merge($re->init(), ['is_route' => false]);
        }
    }
898770
public static function buildUrl($path, $baseUrl = '', $basePath = '', $hostUrl = '')
    {
        $path = str_replace('\\', '/', trim($path));

        //是完整的url路径
        if (UrlHelper::isUrl($path)) {
            return $path;

        }

        // 是url绝对路径
        if ($path{0} === '/') {
            return $hostUrl ? $hostUrl . $path : $path;
        }

        // 相对路径
        $baseUrl = $baseUrl ? rtrim($baseUrl, '/') . '/' : '/';

        if ($basePath) {
            $basePath = rtrim($basePath, '/') . '/';

            if (!file_exists($basePath . $path)) {
                throw new \RuntimeException('资源 [' . $basePath . $path . '] 不存在 !!');
            }
        }

        return ($hostUrl ? $hostUrl . '/' : $baseUrl) . $path;
    }