Пример #1
0
 /**
  * Creates an absolute URL using the given route and query parameters.
  *
  * This method prepends the URL created by [[createUrl()]] with the [[hostInfo]].
  *
  * Note that unlike [[\yii\helpers\Url::toRoute()]], this method always treats the given route
  * as an absolute route.
  *
  * @param string|array $params use a string to represent a route (e.g. `site/index`),
  * or an array to represent a route with query parameters (e.g. `['site/index', 'param1' => 'value1']`).
  * @param string|null $scheme the scheme to use for the URL (either `http`, `https` or empty string
  * for protocol-relative URL).
  * If not specified the scheme of the current request will be used.
  * @return string the created URL
  * @see createUrl()
  */
 public function createAbsoluteUrl($params, $scheme = null)
 {
     $params = (array) $params;
     $url = $this->createUrl($params);
     if (strpos($url, '://') === false) {
         $url = $this->getHostInfo() . $url;
     }
     return Url::ensureScheme($url, $scheme);
 }