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


PHP Request::getQuery方法代码示例

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


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

示例1: testProcessGetRequest

    public function testProcessGetRequest()
    {
        $moduleManager  = $this->getMockBuilder('Zend\ModuleManager\ModuleManager')
                               ->disableOriginalConstructor()
                               ->getMock();
        $moduleManager->expects($this->any())
                      ->method('getLoadedModules')
                      ->will($this->returnValue(array('ZFTest\Apigility\Admin\Model\TestAsset\Bar' => new BarModule)));

        $moduleResource = new ModuleModel($moduleManager, array(), array());
        $controller     = new SourceController($moduleResource);

        $request = new Request();
        $request->setMethod('get');
        $request->getQuery()->module = 'ZFTest\Apigility\Admin\Model\TestAsset\Bar';
        $request->getQuery()->class = 'ZFTest\Apigility\Admin\Model\TestAsset\Bar\Module';

        $controller->setRequest($request);
        $result = $controller->sourceAction();

        $this->assertTrue($result->getVariable('source') != '');
        $this->assertTrue($result->getVariable('file') != '');
        $this->assertEquals($result->getVariable('module'), $request->getQuery()->module);
        $this->assertEquals($result->getVariable('class'), $request->getQuery()->class);
    }
开发者ID:jbarentsen,项目名称:drb,代码行数:25,代码来源:SourceControllerTest.php

示例2: getIdentifier

 /**
  * @return string
  */
 public function getIdentifier($paramName)
 {
     $tokenValue = $this->request->getQuery($paramName, false);
     if ($tokenValue) {
         return $tokenValue;
     }
     return md5(uniqid(rand(), true));
 }
开发者ID:Tribalx,项目名称:Wizard,代码行数:11,代码来源:IdentifierAccessor.php

示例3: getIdentity

 /** @return null|mixed */
 protected function getIdentity()
 {
     $accessToken = $this->request->getQuery('access_token', $this->request->getPost('access_token'));
     if ($accessToken === null) {
         return null;
     }
     $oAuthRequest = OAuth2RequestFactory::create($this->request);
     $accessTokenData = $this->oauthServer->getAccessTokenData($oAuthRequest);
     return $this->identity = $this->identityStorageAdapter->findByUsername($accessTokenData['user_id']);
 }
开发者ID:eschwartz,项目名称:ZfAuth,代码行数:11,代码来源:OAuthUserStorage.php

示例4: __invoke

 /**
  * Return logout text after user has logged out.
  * Shown only after the first page load if loggedOut param is true.
  *
  * @return string Logout message
  */
 public function __invoke()
 {
     if ($this->authManager->userHasLoggedOut() && $this->request->getQuery('logout', false)) {
         if (!isset($this->session->logoutMessageShown) || !$this->session->logoutMessageShown) {
             $this->session->logoutMessageShown = true;
             return 'logout_success_message';
         }
     }
     return false;
 }
开发者ID:samuli,项目名称:vufind-ere,代码行数:16,代码来源:LogoutMessage.php

示例5: fromZend

 /**
  * Convert a Zend\Http\Response in a PSR-7 response, using zend-diactoros
  *
  * @param  ZendRequest $zendRequest
  * @return ServerRequest
  */
 public static function fromZend(ZendRequest $zendRequest)
 {
     $body = new Stream('php://memory', 'wb+');
     $body->write($zendRequest->getContent());
     $headers = empty($zendRequest->getHeaders()) ? [] : $zendRequest->getHeaders()->toArray();
     $query = empty($zendRequest->getQuery()) ? [] : $zendRequest->getQuery()->toArray();
     $post = empty($zendRequest->getPost()) ? [] : $zendRequest->getPost()->toArray();
     $files = empty($zendRequest->getFiles()) ? [] : $zendRequest->getFiles()->toArray();
     $request = new ServerRequest([], self::convertFilesToUploaded($files), $zendRequest->getUriString(), $zendRequest->getMethod(), $body, $headers);
     $request = $request->withQueryParams($query);
     return $request->withParsedBody($post);
 }
开发者ID:MidnightDesign,项目名称:zend-psr7bridge,代码行数:18,代码来源:Psr7ServerRequest.php

示例6: findRegion

 public function findRegion($country, $query)
 {
     $request = new Request();
     $request->setMethod(Request::METHOD_GET);
     foreach ($query as $key => $value) {
         $request->getQuery()->set($key, $value);
     }
     $request->getHeaders()->addHeaderLine('Accept', 'application/json');
     switch ($country) {
         case 'CH':
             $request->setUri($this->config['url'] . '/ch-region');
             break;
         default:
             $request->setUri($this->config['url'] . '/ch-region');
             break;
     }
     $client = new Client();
     $response = $client->send($request);
     $body = $response->getBody();
     $result = json_decode($body, true);
     if ($result) {
         return $result['_embedded']['ch_region'];
     }
     /*echo "<textarea cols='100' rows='30' style='position:relative; z-index:10000; width:inherit; height:200px;'>";
       print_r($body);
       echo "</textarea>";
       die();*/
     return null;
 }
开发者ID:omusico,项目名称:casawp,代码行数:29,代码来源:GeoService.php

示例7: __construct

 /**
  * @param FacebookConfig $config
  */
 public function __construct(array $config, Request $request)
 {
     $this->getParams = $request->getQuery()->toArray();
     $error = $request->getQuery('error');
     if (!empty($error)) {
         $this->isValid = false;
         return;
     }
     //        if (!$config->isEnabled())
     //        {
     //            throw new \Exception('Twitter is not enabled');
     //        }
     $this->consumerKey = $config['consumer_key'];
     $this->consumerSecret = $config['consumer_secret'];
     $this->returnUrlData = $config['return_url'];
 }
开发者ID:middleout,项目名称:third-party-connect,代码行数:19,代码来源:TwitterService.php

示例8: 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

示例9: makeRequestByOperation

 /**
  * Prepare a Zend Request by Operation with $parameters
  *
  * @param Operation $operation
  * @param array $parameters
  * @param int $options BitMask of options to skip or something else
  * @return Request
  * @throws \InvalidArgumentException
  * @throws \RuntimeException
  */
 public function makeRequestByOperation(Operation $operation, array $parameters = [], $options = 0)
 {
     $request = new Request();
     $path = $operation->path;
     if ($operation->parameters) {
         foreach ($operation->parameters as $parameter) {
             if (isset($parameters[$parameter->name])) {
                 switch ($parameter->in) {
                     case 'path':
                         $path = str_replace('{' . $parameter->name . '}', $parameters[$parameter->name], $path);
                         break;
                     case 'query':
                         $request->getQuery()->set($parameter->name, $parameters[$parameter->name]);
                         break;
                     case 'formData':
                         $request->getPost()->set($parameter->name, $parameters[$parameter->name]);
                         break;
                     default:
                         throw new RuntimeException(sprintf('Parameter "%s" with ->in = "%s" is not supported', $parameter->parameter, $parameter->in));
                 }
             } elseif ($parameter->required && !($options & SwaggerWrapper::SKIP_REQUIRED)) {
                 throw new InvalidArgumentException(sprintf('Parameter "%s" is required, please pass value for this in $parameters', $parameter->name));
             }
         }
     }
     $request->setUri($path);
     $request->setMethod($operation->method);
     return $request;
 }
开发者ID:ovr,项目名称:swagger-assert-helper,代码行数:39,代码来源:ZendTrait.php

示例10: testToUriStringMultiQueryOverwrite

 public function testToUriStringMultiQueryOverwrite()
 {
     $request = new Request();
     $request->setUri('http://google.ca/test.html?foo=bar');
     $request->getQuery()->set('foo', 'value');
     $this->assertEquals('http://google.ca/test.html?foo=value', RequestUtils::toUriString($request));
 }
开发者ID:51systems,项目名称:zf2-extensions,代码行数:7,代码来源:RequestUtilsTest.php

示例11: __invoke

 public function __invoke($name = null, $params = [], $options = [], $reuseMatchedParams = false)
 {
     if (null === $this->router) {
         throw new Exception\RuntimeException('No RouteStackInterface instance provided');
     }
     if (3 === func_num_args() && is_bool($options)) {
         $reuseMatchedParams = $options;
         $options = [];
     }
     // Inherit query parameters
     if ($reuseMatchedParams) {
         $providedQueryParams = isset($options['query']) ? $options['query'] : [];
         $currentQueryParams = $this->request->getQuery()->toArray();
         $options['query'] = array_merge($currentQueryParams, $providedQueryParams);
     }
     return parent::__invoke($name, $params, $options, $reuseMatchedParams);
 }
开发者ID:sitrunlab,项目名称:learnzf2,代码行数:17,代码来源:QueryUrl.php

示例12: testQueryAccessTokenProxiesOAuthServer

 public function testQueryAccessTokenProxiesOAuthServer()
 {
     $token = ['user_id' => 'test'];
     $this->setupMockOAuth2Server($token);
     $this->request->getQuery()->set('access_token', 'TOKEN');
     $identity = $this->listener->__invoke($this->mvcAuthEvent);
     $this->assertIdentityMatchesToken($token, $identity);
 }
开发者ID:zfcampus,项目名称:zf-mvc-auth,代码行数:8,代码来源:DefaultAuthenticationListenerTest.php

示例13: create

 public static function create(HttpRequest $request)
 {
     $queryParams = $request->getQuery()->toArray();
     $postParams = $request->getPost()->toArray();
     $files = $request->getFiles()->toArray();
     $cookies = ($c = $request->getCookie()) ? [$c] : [];
     return new OAuth2Request($queryParams, $postParams, [], $cookies, $files, $_SERVER);
 }
开发者ID:eschwartz,项目名称:ZfAuth,代码行数:8,代码来源:OAuth2RequestFactory.php

示例14: setUp

 public function setUp()
 {
     $request = new Request();
     $request->getQuery()->fromArray(array('all' => 'query', 'query_and_post' => 'query'));
     $request->getPost()->fromArray(array('all' => 'post', 'query_and_post' => 'post', 'post_only' => 'post'));
     $this->request = $request;
     $this->routeMatch = new RouteMatch(array('all' => 'route'));
 }
开发者ID:grizzm0,项目名称:zf2-for-1,代码行数:8,代码来源:LegacyParamsTest.php

示例15: getHiddenFilters

 /**
  * Get an array of hidden filters
  *
  * @param string $searchClassId         Active search class
  * @param bool   $returnDefaultsIfEmpty Whether to return default tab filters if
  * no filters are currently active
  * @param bool   $ignoreCurrentRequest  Whether to ignore hidden filters in
  * the current request
  *
  * @return array
  */
 public function getHiddenFilters($searchClassId, $returnDefaultsIfEmpty = true, $ignoreCurrentRequest = false)
 {
     $filters = $ignoreCurrentRequest ? null : $this->request->getQuery('hiddenFilters');
     if (null === $filters && $returnDefaultsIfEmpty) {
         $filters = $this->getDefaultTabHiddenFilters($searchClassId);
     }
     return null === $filters ? [] : $this->parseFilters($searchClassId, $filters);
 }
开发者ID:bbeckman,项目名称:NDL-VuFind2,代码行数:19,代码来源:SearchTabsHelper.php


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