本文整理汇总了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);
}