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


PHP Request::query方法代码示例

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


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

示例1: findCursor

 public function findCursor(Query $query)
 {
     $current = $this->request->query('cursor');
     $limit = $this->request->query('limit') ?: 10;
     if ($current) {
         $query->where(['id >' => $current]);
     }
     $query->limit($limit);
     return $query;
 }
开发者ID:cakeplugins,项目名称:api,代码行数:10,代码来源:CursorHelperBehavior.php

示例2: getUser

 public function getUser(Request $request)
 {
     try {
         $this->Server->isValidRequest(true, $request->query('access_token'));
         $ownerModel = $this->Server->getAccessToken()->getSession()->getOwnerType();
         $ownerId = $this->Server->getAccessToken()->getSession()->getOwnerId();
         $event = new Event('OAuthServer.getUser', $request, [$ownerModel, $ownerId]);
         EventManager::instance()->dispatch($event);
         if ($event->result) {
             return $event->result;
         } else {
             $model = TableRegistry::get($ownerModel);
             return $model->get($ownerId)->toArray();
         }
     } catch (OAuthException $e) {
         $this->_exception = $e;
         return false;
     }
 }
开发者ID:surjit,项目名称:oauth-server,代码行数:19,代码来源:OAuthAuthenticate.php

示例3: testQueryWithArray

 /**
  * Test the query() method with arrays passed via $_GET
  *
  * @return void
  */
 public function testQueryWithArray()
 {
     $get['test'] = ['foo', 'bar'];
     $request = new Request(['query' => $get]);
     $result = $request->query('test');
     $this->assertEquals(['foo', 'bar'], $result);
     $result = $request->query('test.1');
     $this->assertEquals('bar', $result);
     $result = $request->query('test.2');
     $this->assertNull($result);
 }
开发者ID:alexunique0519,项目名称:Blog_Cakephp_association,代码行数:16,代码来源:RequestTest.php

示例4: _getToken

 /**
  * Get token from header or query string.
  *
  * @param \Cake\Network\Request $request Request object.
  * @return string|bool Token string if found else false.
  */
 protected function _getToken($request)
 {
     $token = $request->env('HTTP_AUTHORIZATION');
     // @codeCoverageIgnoreStart
     if (!$token && function_exists('getallheaders')) {
         $headers = getallheaders();
         if (isset($headers['Authorization']) && substr($headers['Authorization'], 0, 7) === 'Bearer ') {
             $token = $headers['Authorization'];
         }
     }
     // @codeCoverageIgnoreEnd
     if ($token) {
         return substr($token, 7);
     }
     if (!empty($this->_config['parameter']) && isset($request->query[$this->_config['parameter']])) {
         $token = $request->query($this->_config['parameter']);
     }
     return $token ? $token : false;
 }
开发者ID:jadb,项目名称:cakephp-jwt-auth,代码行数:25,代码来源:JwtAuthenticate.php

示例5: querystring

 /**
  * Get the api key from the querystring
  *
  * @param Request $request request
  * @return string api key
  */
 public function querystring(Request $request)
 {
     $name = $this->config('name');
     return $request->query($name);
 }
开发者ID:CakeDC,项目名称:users,代码行数:11,代码来源:ApiKeyAuthenticate.php

示例6: getToken

 /**
  * Get token from header or query string.
  *
  * @param \Cake\Network\Request|null $request Request object.
  * @return string|null Token string if found else null.
  */
 public function getToken($request = null)
 {
     $config = $this->_config;
     if (!$request) {
         return $this->_token;
     }
     $header = $request->header($config['header']);
     if ($header) {
         return $this->_token = str_ireplace($config['prefix'] . ' ', '', $header);
     }
     if (!empty($this->_config['parameter'])) {
         $token = $request->query($this->_config['parameter']);
     }
     return $this->_token = $token;
 }
开发者ID:voycey,项目名称:cakephp-jwt-auth,代码行数:21,代码来源:JwtAuthenticate.php

示例7: _getToken

 /**
  * Get token from header or query string.
  *
  * @param \Cake\Network\Request $request Request object.
  * @return string|bool Token string if found else false.
  */
 protected function _getToken($request)
 {
     $token = $request->env('HTTP_AUTHORIZATION');
     // @codeCoverageIgnoreStart
     if (!$token && function_exists('getallheaders')) {
         // index of the array returned by the function getallheaders() is case-insensitive.
         // @see http://php.net/manual/en/function.getallheaders.php#52029
         $headers = array_change_key_case(getallheaders());
         if (isset($headers['authorization']) && substr($headers['authorization'], 0, 7) === 'Bearer ') {
             $token = $headers['authorization'];
         }
     }
     // @codeCoverageIgnoreEnd
     if ($token) {
         return substr($token, 7);
     }
     if (!empty($this->_config['parameter']) && isset($request->query[$this->_config['parameter']])) {
         $token = $request->query($this->_config['parameter']);
     }
     return $token ? $token : false;
 }
开发者ID:johnsoons,项目名称:cakephp-jwt-auth,代码行数:27,代码来源:JwtAuthenticate.php

示例8: getPrev

 /**
  * Get the prev cursor value.
  *
  * @return mixed
  */
 public function getPrev()
 {
     return $this->request->query('previous');
 }
开发者ID:cakeplugins,项目名称:api,代码行数:9,代码来源:CakeCursorAdapter.php

示例9: getToken

 /**
  * Get token from header or query string.
  *
  * @param \Cake\Network\Request|null $request Request object.
  *
  * @return string|null Token string if found else null.
  */
 public function getToken($request = null)
 {
     $config = $this->_config;
     if (!$request) {
         return $this->_token;
     }
     // $header = $request->header($config['header']);
     $header = isset(getallheaders()['Authorization']) ? getallheaders()['Authorization'] : null;
     if ($header) {
         return $this->_token = str_ireplace($config['prefix'] . ' ', '', $header);
     }
     if (!empty($this->_config['parameter'])) {
         $token = $request->query($this->_config['parameter']);
     }
     return $this->_token = $token;
 }
开发者ID:oxenti,项目名称:user,代码行数:23,代码来源:OxentiJwtAuthenticate.php


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