コード例 #1
0
ファイル: Js.php プロジェクト: IdealsSpace/wechat
 /**
  * 获取当前URL
  *
  * @return string
  */
 public function getUrl()
 {
     if ($this->url) {
         return $this->url;
     }
     return Url::current();
 }
コード例 #2
0
 public function url()
 {
     $url = new Url('wx8e883164d9342b1f', 'e73145bd0fdef28ea54b0b3608061c33');
     $shortUrl = $url->short('http://overtrue.me/open-source');
     var_dump($shortUrl);
 }
コード例 #3
0
 /**
  * 生成outh URL.
  *
  * @param string $to
  * @param string $scope
  * @param string $state
  *
  * @return string
  */
 public function url($to = null, $scope = 'snsapi_userinfo', $state = 'STATE')
 {
     $to !== null || ($to = Url::current());
     $params = array('appid' => $this->appId, 'redirect_uri' => $to, 'response_type' => 'code', 'scope' => $scope, 'state' => $state);
     return self::API_URL . '?' . http_build_query($params) . '#wechat_redirect';
 }
コード例 #4
0
ファイル: Auth.php プロジェクト: nutsdo/rp-wechat
 /**
  * 直接跳转
  *
  * @param string $to
  * @param string $scope
  * @param string $state
  */
 public function redirect($to = null, $scope = 'snsapi_userinfo', $state = 'STATE')
 {
     $to !== null || ($to = Url::current());
     header('Location:' . $this->url($to, $scope, $state));
     exit;
 }