當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。