传入参数，生成当前路由的uri

@param  array $params URI参数
@return string
@throws RouteException
494966
public function uri(array $params = null)
    {
        $defaults = $this->_defaults;

        if (isset($params['controller']))
        {
            $params['controller'] = strtolower($params['controller']);
        }
        if (isset($params['directory']))
        {
            $params['directory'] = strtolower($params['directory']);
        }

        /**
         * 匿名函数，用于循环替换路由参数
         *
         * @param  string  $portion  URI定义部分
         * @param  boolean $required 参数是否必须的
         * @return array 返回保存参数的数组
         * @throws RouteException
         */
        $compile = function ($portion, $required) use (&$compile, $defaults, $params)
        {
            $missing = [];

            $pattern = '#(?:' . Route::REGEX_KEY . '|' . Route::REGEX_GROUP . ')#';
            $result = preg_replace_callback($pattern, function ($matches) use (&$compile, $defaults, &$missing, $params, &$required)
            {
                if ('<' === $matches[0][0])
                {
                    $param = $matches[1];

                    if (isset($params[$param]))
                    {
                        $required = ($required || ! isset($defaults[$param]) || $params[$param] !== $defaults[$param]);
                        return $params[$param];
                    }

                    // 直接返回参数默认值
                    if (isset($defaults[$param]))
                    {
                        return $defaults[$param];
                    }

                    $missing[] = $param;
                }
                else
                {
                    $result = $compile($matches[2], false);

                    if ($result[1])
                    {
                        $required = true;
                        return $result[0];
                    }
                }

                return null;
            }, $portion);

            if ($required && $missing)
            {
                throw new RouteException('Required route parameter not passed: :param', [
                    ':param' => reset($missing),
                ]);
            }

            return [
                $result,
                $required,
            ];
        };

        $result = $compile($this->_uri, true);
        Base::getLog()->debug(__METHOD__ . ' get route compile result', [
            'identify' => $this->identify,
            'result'   => $result,
        ]);
        $uri = $result ? array_shift($result) : $result;

        // 过滤URI中的重复斜杆
        $uri = preg_replace('#//+#', '/', rtrim($uri, '/'));

        // 如果是外部链接
        if ($this->isExternal())
        {
            $host = $this->_defaults['host'];
            // 使用默认协议
            if (false === strpos($host, '://'))
            {
                $host = Route::$defaultProtocol . $host;
            }
            $uri = rtrim($host, '/') . '/' . $uri;
        }

        return $uri;
    }
928756
protected function _getCreateUrlTree(&$params)
    {
        $id = (int)ArrayHelper::getValue($params, 'id');
        $treeModel = ArrayHelper::getValue($params, 'model');

        $dir = ArrayHelper::getValue($params, 'dir');
        $site_code = ArrayHelper::getValue($params, 'site_code');

        ArrayHelper::remove($params, 'id');
        ArrayHelper::remove($params, 'model');

        ArrayHelper::remove($params, 'dir');
        ArrayHelper::remove($params, 'site_code');


        if ($treeModel && $treeModel instanceof Tree) {
            $tree = $treeModel;
            self::$models[$treeModel->id] = $treeModel;

            return $tree;
        }

        if ($id) {
            $tree = ArrayHelper::getValue(self::$models, $id);

            if ($tree) {
                return $tree;
            } else {
                $tree = CmsTree::findOne(['id' => $id]);
                self::$models[$id] = $tree;
                return $tree;
            }
        }


        if ($dir) {
            if (!$site_code && \Yii::$app->cms && \Yii::$app->cms->site) {
                $site_code = \Yii::$app->cms->site->code;
            }

            if ($site_code) {
                $cmsSite = CmsSite::getByCode($site_code);
            }

            if (!$cmsSite) {
                return null;
            }

            $tree = CmsTree::findOne([
                'dir' => $dir,
                'cms_site_id' => $cmsSite->id
            ]);

            if ($tree) {
                self::$models[$id] = $tree;
                return $tree;
            }
        }


        return null;
    }
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 : '');
    }
70799
public function createUrl($params=array())
    {
        return Yii::app()->createUrl($this->route, CMap::mergeArray($params, $this->evaluateParams($this->params)));
    }
752809
private function generateUrlForRoute($route, $params)
    {
        $url = $route['uri'];

        while (count($params) > 0) {
            $param = array_shift($params);
            $url = preg_replace('/{.+?}/', $param, $url, 1);
        }

        return $url;
    }
979913
protected function getQueryParams(array $params = []): string
    {
        if (empty($params)) {
            return '';
        }
        $query = $params['query'] ?? [];
        if (is_string($query)) {
            return $query;
        }
        return empty($query) ? '' : http_build_query($query);
    }
549388
public function generateUrl(array $routeParameters = []): string
    {
        $url = $this->getUrl();
        $url = \preg_replace('/\{(\w+?):(.+?)\}/', '{$1}', $url);
        foreach ($routeParameters as $parameter => $value) {
            $url = \str_replace('{' . $parameter . '}', $value, $url);
        }

        return $url;
    }
1358913
protected function buildUrl($uri, $params)
    {
        $host = $this->buildHostString();

        if (strpos($uri, "/") !== 0) {
            $uri = "/" . $uri;
        }

        $url = $host . $uri;


        if ($params === null) {
            $params = array();
        }

        $url .= $this->buildQueryString($params);

        return $url;
    }
818704
public function get($uri, array $params = array())
    {

        $uri .= '?' . http_build_query($params);
        return $this->client->get($uri);

    }
537372
static public function urlAppend(string $url, array $params): string
    {
        // 如果已经有参数,附加&,否则附加?
        if (!strpos($url, '?')) {
            $url .= "?";
        } else {
            $url .= "&";
        }

        // 逐个参数附加
        foreach ($params as $k => $v) {
            $url .= "$k=$v&";
        }

        // 去掉最后的&
        $url = trim($url, '&');

        // 返回新的URL
        return $url;
    }
1094026
public function generate($route_name, $params = array()) {

    $path_s = $this->sm->get('pegase.core.path');

    if(!array_key_exists($route_name, $this->routes))
      throw new PegaseException(
        "The array key <span style='color:blue;'>`$route_name`</span> doesn't exists.<br />"
      );
    else {
      
      $route_infos = $this->routes[$route_name];
      
      $path = $path_s->get_html_path($route_infos[0]);
      $path = '/' . $path;
  
      $path = $this->replace_with_params($path, $params);
      //$path = $_SERVER['REQUEST_URI'] . $path;
      $path = substr($path, 1);
      
    }

    return $path;
  }
82760
private function getUriRegexFromParameters($uri, $params)
    {
        $regex = str_replace('/', '\/', $uri);
        foreach ($params as $param) {
            $regex = str_replace('{' . $param . '}', '([^\/]+)', $regex);
        }
        return $regex;
    }
513162
public function url($name, $params = array()) {
		if (!isset($this->namedRoutes[$name])) {
			throw new RouterException("No route matches this name : $name");
		}

		return $this->namedRoutes[$name]->getUrl($params);
	}
18066
public function get($uri, array $params = array())
    {

        $uri .= '?' . http_build_query($params);

        $ch = $this->initCurlHandler($uri);
        return $this->makeRequest($ch);

    }
1352618
public function composeUri($params)
    {
        $ret   = '';
        $first = true;

        foreach ($params as $param => $values) {
            if (!$first) {
                $ret .= $this->seperators['param'];
            }
            $first    = false;
            $internal = $param;
            if ($external = $this->translateKeyOutput($param)) {
                $param = $external;
            }
            $ret .= $param . $this->seperators['key_value'];
            $firstValue = true;
            foreach ($values as $value) {
                if ($external = $this->translateValueOutput($internal, $value)) {
                    $value = $external;
                }
                if (!$firstValue) {
                    $ret .= $this->seperators['value'];
                } else {
                    $firstValue = false;
                }
                $ret .= urlencode($value);
            }
        }

        return $ret;
    }
1142640
protected function urlize($params)
    {
        $string = "";
        foreach ($params as $key => $value) {
            $string .= $key . '=' . urlencode(trim($value)) . '&';
        }
        return rtrim($string, "& ");
    }
1275917
public function get($uri, array $params = array())
    {

        $request = HttpFoundation\Request::create($uri, 'GET', $params);
        $uri = $request->getUri();

        $ch = $this->initCurlHandler($uri);
        return $this->makeRequest($ch);

    }