当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::getRequestUri方法代码示例

本文整理汇总了PHP中Zend\Http\Request::getRequestUri方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getRequestUri方法的具体用法?PHP Request::getRequestUri怎么用?PHP Request::getRequestUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Http\Request的用法示例。


在下文中一共展示了Request::getRequestUri方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: login

 /**
  * Login
  *
  * @param \Zend\Http\Request $request
  * @param \Zend\Http\Response $response
  * @return null|array|\Zend\Http\Response
  */
 public function login(array $options, HttpRequest $request, HttpResponse $response = null)
 {
     if (null === $response) {
         $response = new PhpResponse();
     }
     $session = $this->getSessionContainer();
     $code = $request->getQuery('code');
     if (empty($options['redirect_uri'])) {
         $options['redirect_uri'] = $request->getUri()->getScheme() . '://' . $this->getSiteInfo()->getFulldomain() . $request->getRequestUri();
     }
     if (empty($code)) {
         $session['state'] = String::generateRandom(32);
         $session['redirect_uri'] = $options['redirect_uri'];
         $response->setContent('')->setStatusCode(302)->getHeaders()->clearHeaders()->addHeaderLine('Location', static::DIALOG_URI . '?' . http_build_query(array('client_id' => $options['client_id'], 'redirect_uri' => $options['redirect_uri'], 'state' => $session['state'], 'scope' => 'email')));
         if ($response instanceof PhpResponse) {
             $response->send();
             exit;
         } else {
             return $response;
         }
     }
     $state = $request->getQuery('state');
     if (empty($session['state']) || $state !== $session['state']) {
         return null;
     }
     $client = $this->getHttpClient();
     $params = null;
     @parse_str($client->setMethod('GET')->setUri(static::ACCESS_URI)->setParameterGet(array('client_id' => $options['client_id'], 'redirect_uri' => $session['redirect_uri'], 'client_secret' => $options['client_secret'], 'code' => $code))->send()->getBody(), $params);
     unset($session['state']);
     unset($session['redirect_uri']);
     if (empty($params['access_token'])) {
         return null;
     }
     return @json_decode($client->setMethod('GET')->setUri(static::API_URI)->setParameterGet(array('access_token' => $params['access_token']))->send()->getBody(), true);
 }
开发者ID:gridguyz,项目名称:facebooklogin,代码行数:42,代码来源:Client.php


注:本文中的Zend\Http\Request::getRequestUri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。