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


PHP Request::getQuery方法代码示例

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


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

示例1: getToken

 public function getToken(Request $request)
 {
     if (isset($this->session->token)) {
         return true;
     } elseif (strlen($this->session->state) > 0 and $this->session->state == $request->getQuery('state') and strlen($request->getQuery('code')) > 5) {
         $client = $this->getHttpClient();
         $client->setUri($this->options->getTokenUri());
         $client->setMethod(Request::METHOD_POST);
         $client->setParameterPost(array('code' => $request->getQuery('code'), 'client_id' => $this->options->getClientId(), 'client_secret' => $this->options->getClientSecret(), 'redirect_uri' => $this->options->getRedirectUri(), 'grant_type' => 'authorization_code'));
         $resBody = $client->send()->getBody();
         try {
             $response = JsonDecoder::decode($resBody, Json::TYPE_ARRAY);
             if (is_array($response) and isset($response['access_token']) and !isset($response['expires']) || $response['expires'] > 0) {
                 $this->session->token = (object) $response;
                 return true;
             } else {
                 $this->error = array('internal-error' => 'Instagram settings error.', 'message' => $response->error_message, 'type' => $response->error_type, 'code' => $response->code);
                 return false;
             }
         } catch (\Zend\Json\Exception\RuntimeException $e) {
             $this->error = array('internal-error' => 'Parse error.', 'message' => $e->getMessage(), 'code' => $e->getCode());
             return false;
         }
     } else {
         $this->error = array('internal-error' => 'State error, request variables do not match the session variables.', 'session-state' => $this->session->state, 'request-state' => $request->getQuery('state'), 'code' => $request->getQuery('code'));
         return false;
     }
 }
开发者ID:priorist,项目名称:zf-reverseoauth2,代码行数:28,代码来源:Instagram.php

示例2: getToken

 public function getToken(Request $request)
 {
     if (isset($this->session->token)) {
         return true;
     } elseif (strlen($this->session->state) > 0 and $this->session->state == $request->getQuery('state') and strlen($request->getQuery('code')) > 5) {
         $client = $this->getHttpClient();
         $client->setUri($this->options->getTokenUri());
         $client->setMethod(Request::METHOD_POST);
         $client->setParameterPost(array('code' => $request->getQuery('code'), 'client_id' => $this->options->getClientId(), 'client_secret' => $this->options->getClientSecret(), 'redirect_uri' => $this->options->getRedirectUri()));
         $retVal = $client->send()->getContent();
         parse_str($retVal, $token);
         if (is_array($token) and isset($token['access_token']) and $token['expires'] > 0) {
             $this->session->token = (object) $token;
             return true;
         } else {
             try {
                 $error = \Zend\Json\Decoder::decode($retVal);
                 $this->error = array('internal-error' => 'Facebook settings error.', 'message' => $error->error->message, 'type' => $error->error->type, 'code' => $error->error->code);
             } catch (\Zend\Json\Exception\RuntimeException $e) {
                 $this->error = $token;
                 $this->error['internal-error'] = 'Unknown error.';
             }
             return false;
         }
     } else {
         $this->error = array('internal-error' => 'State error, request variables do not match the session variables.', 'session-state' => $this->session->state, 'request-state' => $request->getQuery('state'), 'code' => $request->getQuery('code'));
         return false;
     }
 }
开发者ID:GuestToGuestTeam,项目名称:ReverseOAuth2,代码行数:29,代码来源:Facebook.php

示例3: getToken

 public function getToken(Request $request)
 {
     if (isset($this->session->token)) {
         return true;
     } elseif (strlen($this->session->state) > 0 and $this->session->state == $request->getQuery('state') and strlen($request->getQuery('code')) > 5) {
         $client = $this->getHttpClient();
         $client->setUri($this->options->getTokenUri());
         $client->setMethod(Request::METHOD_POST);
         $client->setParameterPost(array('code' => $request->getQuery('code'), 'client_id' => $this->options->getClientId(), 'client_secret' => $this->options->getClientSecret(), 'redirect_uri' => $this->options->getRedirectUri(), 'grant_type' => 'authorization_code'));
         $retVal = $client->send()->getBody();
         try {
             $token = \Zend\Json\Decoder::decode($retVal);
             if (isset($token->access_token) and $token->expires_in > 0) {
                 $this->session->token = $token;
                 return true;
             } else {
                 $this->error = array('internal-error' => 'Google settings error.', 'error' => $token->error, 'token' => $token);
                 return false;
             }
         } catch (\Zend\Json\Exception\RuntimeException $e) {
             $this->error['internal-error'] = 'Unknown error.';
             $this->error['token'] = $retVal;
             return false;
         }
     } else {
         $this->error = array('internal-error' => 'State error, request variables do not match the session variables.', 'session-state' => $this->session->state, 'request-state' => $request->getQuery('state'), 'code' => $request->getQuery('code'));
         return false;
     }
 }
开发者ID:priorist,项目名称:zf-reverseoauth2,代码行数:29,代码来源:Google.php

示例4: getList

 /**
  * @param array $search
  * @param array $orderBy
  * @param array $parameters
  *
  * @return \Zend\Paginator\Paginator
  */
 public function getList($search = [], $orderBy = [], $parameters = [])
 {
     $query = $this->mainRepository->getAdminPage($search, $orderBy, $parameters);
     $paginator = $this->paginatorFactory->getQueryPaginator($query);
     $paginator->setCurrentPageNumber($this->request->getQuery(self::PAGE, 0));
     $paginator->setItemCountPerPage(5);
     return $paginator;
 }
开发者ID:peteraba,项目名称:dm-mailer,代码行数:15,代码来源:Base.php

示例5: testListAction

 /**
  * @dataProvider getListActionProvider
  */
 public function testListAction($page, $limit)
 {
     $query = $this->request->getQuery();
     $query->set('page', $page);
     $query->set('limit', $limit);
     $this->docs->expects($this->once())->method('getList')->with($page, $limit);
     $this->routeMatch->setParam('action', 'list');
     $result = $this->object->dispatch($this->request, $this->response);
     $this->assertInternalType('array', $result);
     $this->assertArrayHasKey('dataSet', $result);
 }
开发者ID:widmogrod,项目名称:zf2-rest-api-documentator,代码行数:14,代码来源:DocsController.php

示例6: checkURL

 private function checkURL()
 {
     $url = parent::getUri()->getPath();
     $get = parent::getQuery()->toArray();
     $explodeUrl = explode('/', $url);
     array_shift($explodeUrl);
     array_shift($explodeUrl);
     if (empty($explodeUrl[0])) {
         throw new \Exception('Empty Resource');
     }
     $this->resourse = $explodeUrl[0];
     array_shift($explodeUrl);
     $max = count($explodeUrl);
     for ($i = 0; $i < $max; $i += 2) {
         $name = $explodeUrl[$i];
         if (empty($name)) {
             continue;
         }
         if (!$this->checkParamName($name)) {
             throw new \Exception('Invalid Parameter Name (' . $name . ')');
         }
         $value = isset($explodeUrl[$i + 1]) ? $explodeUrl[$i + 1] : null;
         $this->urlParameters[$name] = urldecode($value);
     }
     foreach ($get as $name => $value) {
         if (!$this->checkParamName($name)) {
             throw new \Exception('Invalid Parameter Name (' . $name . ')');
         }
     }
     $this->urlParameters = array_merge($this->urlParameters, $get);
 }
开发者ID:rockeinstein,项目名称:library,代码行数:31,代码来源:ApiRequestImp.php

示例7: __construct

 /**
  * @param Request $request
  * @param Di $di
  */
 public function __construct(Request $request, Di $di)
 {
     $inputFilter = $this->getFactory()->createInputFilter(['width' => ['name' => 'width', 'required' => false, 'validators' => [['name' => 'digits'], ['name' => 'between', 'options' => ['min' => 150, 'max' => 19200]]]], 'height' => ['name' => 'height', 'required' => false, 'validators' => [['name' => 'digits'], ['name' => 'between', 'options' => ['min' => 150, 'max' => 19200]]]], 'username' => ['name' => 'username', 'required' => false, 'validators' => [['name' => 'not_empty'], ['name' => 'regex', 'options' => ['pattern' => '/^[a-zA-Z0-9._]+$/']]]], 'limit' => ['name' => 'limit', 'required' => false, 'validators' => [['name' => 'digits'], ['name' => 'between', 'options' => ['min' => 5, 'max' => 100]]]], 'hex' => ['name' => 'hex', 'required' => false, 'validators' => [['name' => 'hex']], 'filters' => [['name' => 'callback', 'options' => ['callback' => function ($value) {
         return ltrim($value, '#');
     }]]]], 'source' => ['name' => 'source', 'required' => true, 'validators' => [['name' => 'inarray', 'options' => ['haystack' => [SourceNameInterface::SOURCE_USER, SourceNameInterface::SOURCE_FEED]]]]], 'quality' => ['name' => 'quality', 'required' => false, 'validators' => [['name' => 'inarray', 'options' => ['haystack' => [QualityInterface::QUALITY_THUMBNAIL, QualityInterface::QUALITY_LOW_RES, QualityInterface::QUALITY_STANDARD_RES]]]]]]);
     $this->merge($inputFilter);
     $this->setData($this->initDefaults($request->getQuery()));
 }
开发者ID:spalax,项目名称:ua-webchalange-instagram-collage,代码行数:12,代码来源:ConfigurationData.php

示例8: wordsListAction

 public function wordsListAction(Request $request, Finder $finder, Filter $filterForm, ViewModel $view)
 {
     $limit = $request->getQuery('limit', 20);
     $page = $request->getQuery('page', 1);
     $view->setFilter($filterForm);
     $filterForm->setData($request->getQuery());
     if (!$filterForm->isValid()) {
         return $view;
     }
     $collection = $finder->findByFilter($this->buildCriteria($filterForm->getData()), $limit, $page);
     $count = $finder->count($this->buildCriteria($filterForm->getData()));
     $view->setCollection($collection);
     $pageParams = $request->getQuery()->toArray();
     $pageParams['countObject'] = $count;
     $pageParams['page'] = $page;
     $pageParams['limit'] = $limit;
     $view->setPageParams($pageParams);
     return $view;
 }
开发者ID:sebaks,项目名称:Translate,代码行数:19,代码来源:ListsController.php

示例9: getSessionIdFromRequest

 /**
  * @param \Zend\Http\PhpEnvironment\Request $request
  * @return string|null
  */
 protected function getSessionIdFromRequest($request)
 {
     $ssid = $request->getPost(static::SESSION_ID_ALIAS);
     if (!$ssid) {
         $ssid = $request->getQuery(static::SESSION_ID_ALIAS);
     }
     if (!$ssid) {
         return null;
     }
     return $ssid;
 }
开发者ID:qshurick,项目名称:auth,代码行数:15,代码来源:Authentication.php

示例10: createFromRequest

 public static function createFromRequest(BaseRequest $request)
 {
     $new = static::fromString($request->toString());
     $new->setQuery($request->getQuery());
     $new->setPost($request->getPost());
     $new->setCookies($request->getCookie());
     $new->setFiles($request->getFiles());
     $new->setServer($request->getServer());
     $new->setContent($request->getContent());
     $new->setEnv($request->getEnv());
     $headers = $request->getHeaders();
     $new->setHeaders($headers);
     return $new;
 }
开发者ID:diablomedia,项目名称:oauth2-server-zendhttp-bridge,代码行数:14,代码来源:Request.php

示例11: getToken

 public function getToken(Request $request)
 {
     if (isset($this->session->token)) {
         return true;
     } elseif (strlen($this->session->state) > 0 and $this->session->state == $request->getQuery('state') and strlen($request->getQuery('code')) > 5) {
         $client = $this->getHttpClient();
         $client->setUri($this->options->getTokenUri());
         $client->setMethod(Request::METHOD_POST);
         $client->setParameterPost(array('code' => $request->getQuery('code'), 'client_id' => $this->options->getClientId(), 'client_secret' => $this->options->getClientSecret(), 'redirect_uri' => $this->options->getRedirectUri(), 'state' => $this->getState()));
         $retVal = $client->send()->getContent();
         parse_str($retVal, $token);
         if (is_array($token) and isset($token['access_token'])) {
             $this->session->token = (object) $token;
             return true;
         } else {
             $this->error = array('error' => $retVal, 'internal-error' => 'Unknown error.');
             return false;
         }
     } else {
         $this->error = array('internal-error' => 'State error, request variables do not match the session variables.', 'session-state' => $this->session->state, 'request-state' => $request->getQuery('state'), 'code' => $request->getQuery('code'));
         return false;
     }
 }
开发者ID:misarji,项目名称:zend-oauth2,代码行数:23,代码来源:Github.php

示例12: selectSite

 /**
  * 
  * {@inheritDoc}
  */
 public function selectSite(Request $request, Response $response)
 {
     if (!$request->isGet()) {
         return false;
     }
     $siteId = $request->getQuery('siteId', self::ENGLISH_SITE_ID);
     $site = $this->siteService->find($siteId);
     if (!$site) {
         $siteId = self::ENGLISH_SITE_ID;
     }
     // Just in case
     $this->siteId = $siteId;
     $cookie = new SetCookie(self::SITE_ID_COOKIE, $siteId, time() + 30 * 24 * 60 * 60);
     // now + 1 month
     $response->getHeaders()->addHeader($cookie);
     return true;
 }
开发者ID:FiftyNine,项目名称:ScpperDB,代码行数:21,代码来源:UtilityService.php

示例13: testIllegalMethod

 /**
  * Test an illegal auth method
  *
  * @return void
  *
  * @expectedException        \Exception
  * @expectedExceptionMessage Illegal setting: foo
  */
 public function testIllegalMethod()
 {
     $request = new Request();
     $request->getQuery()->set('auth_method', 'foo');
     $ca = $this->getChoiceAuth();
     $ca->updatePassword($request);
 }
开发者ID:datavoyager,项目名称:vufind,代码行数:15,代码来源:ChoiceAuthTest.php

示例14: setStrategyFromRequest

 /**
  * Set the active strategy based on the auth_method value in the request,
  * if found.
  *
  * @param Request $request Request object to check.
  *
  * @return void
  */
 protected function setStrategyFromRequest($request)
 {
     // Set new strategy; fall back to old one if there is a problem:
     $defaultStrategy = $this->strategy;
     $this->strategy = trim($request->getPost()->get('auth_method'));
     if (empty($this->strategy)) {
         $this->strategy = trim($request->getQuery()->get('auth_method'));
     }
     if (empty($this->strategy)) {
         $this->strategy = $defaultStrategy;
         if (empty($this->strategy)) {
             throw new AuthException('authentication_error_technical');
         }
     }
 }
开发者ID:tillk,项目名称:vufind,代码行数:23,代码来源:ChoiceAuth.php

示例15: deleteAction

 public function deleteAction(Request $request, Params $params, Delete $deleteService, Redirect $redirect)
 {
     $deleteService->delete((int) $params('id'));
     return $redirect->toRoute('admin-translate-words', [], ['query' => $request->getQuery()->toArray()]);
 }
开发者ID:sebaks,项目名称:Translate,代码行数:5,代码来源:WordController.php


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