Thenbsp\Wechat\Bridge\Util::getCurrentUrl PHP Method

getCurrentUrl() public static method

获取当前 URL
public static getCurrentUrl ( )
    public static function getCurrentUrl()
    {
        $protocol = isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://';
        return $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    }

Usage Example

Exemplo n.º 1
0
 /**
  * 获取授权 URL
  */
 public function getAuthorizeUrl()
 {
     if (null === $this->state) {
         $this->state = Util::getRandomString(16);
     }
     $this->stateManager->setState($this->state);
     $query = array('appid' => $this->appid, 'redirect_uri' => $this->redirectUri ?: Util::getCurrentUrl(), 'response_type' => 'code', 'scope' => $this->resolveScope(), 'state' => $this->state);
     return $this->resolveAuthorizeUrl() . '?' . http_build_query($query);
 }
All Usage Examples Of Thenbsp\Wechat\Bridge\Util::getCurrentUrl