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


PHP Request::getPost方法代码示例

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


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

示例1: isGranted

 /**
  *
  * @param MvcEvent $event            
  * @return bool
  */
 public function isGranted(MvcEvent $event)
 {
     $request = $event->getRequest();
     if (!$request instanceof HttpRequest) {
         return true;
     }
     if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
         $clientIp = $_SERVER['HTTP_X_FORWARDED_FOR'];
     } else {
         $clientIp = $_SERVER['REMOTE_ADDR'];
     }
     if (array_key_exists($clientIp, $this->users)) {
         $user = $this->users[$clientIp];
         if ($this->auth->hasIdentity()) {
             // do nothing
         } else {
             $adapter = $this->auth->getAdapter();
             $request = new HttpRequest();
             $request->setMethod(HttpRequest::METHOD_POST);
             $request->getPost()->identity = $user['user'];
             $request->getPost()->credential = $user['password'];
             $request->setContent($request->getPost()->toString());
             $result = $adapter->prepareForAuthentication($request);
             $authenticate = $this->auth->authenticate($adapter);
             if (!$authenticate->isValid()) {
                 error_log('FAIL');
             }
         }
     }
     return true;
 }
开发者ID:LeCoyote,项目名称:epeires2,代码行数:36,代码来源:AutoConnectGuard.php

示例2: process

 public function process()
 {
     if (!$this->wizard || !$this->request->isPost()) {
         return;
     }
     $post = $this->request->getPost();
     $values = $post->getArrayCopy();
     if (isset($values['previous'])) {
         $this->wizard->previousStep();
         return;
     }
     if (isset($values['cancel'])) {
         return $this->doCancel();
     }
     $this->processCurrentStep($values);
     $steps = $this->wizard->getSteps();
     $currentStep = $this->wizard->getCurrentStep();
     if (!$currentStep->isComplete()) {
         return;
     }
     if ($currentStep->isComplete() && $steps->isLast($currentStep)) {
         return $this->completeWizard();
     }
     $this->wizard->nextStep();
 }
开发者ID:Tribalx,项目名称:Wizard,代码行数:25,代码来源:WizardProcessor.php

示例3: createTokenResponse

 /**
  * {@inheritDoc}
  */
 public function createTokenResponse(Request $request, Client $client = null, TokenOwnerInterface $owner = null)
 {
     $token = $request->getPost('access_token');
     $scope = $request->getPost('scope');
     if (null === $token) {
         throw OAuth2Exception::invalidRequest('Missing parameter access_token');
     }
     $owner = $this->getOwner($token);
     if (!$owner instanceof TokenOwnerInterface) {
         throw OAuth2Exception::accessDenied('Unable to load user from this token');
     }
     /**
      * @var AccessToken       $accessToken
      * @var null|RefreshToken $refreshToken
      * */
     $accessToken = new AccessToken();
     $refreshToken = null;
     // Generate token
     $this->populateToken($accessToken, $client, $owner, $scope);
     $accessToken = $this->accessTokenService->createToken($accessToken);
     // Before generating a refresh token, we must make sure the authorization server supports this grant
     if ($this->authorizationServer->hasGrant(RefreshTokenGrant::GRANT_TYPE)) {
         $refreshToken = new RefreshToken();
         $this->populateToken($refreshToken, $client, $owner, $scope);
         $refreshToken = $this->refreshTokenService->createToken($refreshToken);
     }
     return $this->prepareTokenResponse($accessToken, $refreshToken);
 }
开发者ID:omusico,项目名称:mostad-social-grant,代码行数:31,代码来源:AbstractSocialGrant.php

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

示例5: deleteAction

 public function deleteAction()
 {
     if ($this->request->isPost()) {
         if ($this->request->getPost('confirm') === 'oui') {
             $id = $this->params('id');
             $this->contactService->delete($id);
         }
         return $this->redirect()->toRoute('address-book-contact');
     }
     return $this->showAction();
 }
开发者ID:bioub,项目名称:Formation_ZF2_Adista_201602,代码行数:11,代码来源:ContactController.php

示例6: addAction

 public function addAction()
 {
     $form = $this->service->createForm();
     if ($this->request->isPost()) {
         $data = $this->request->getPost();
         if ($this->service->insert($data)) {
             return $this->redirect()->toRoute('contact');
         }
     }
     return new ViewModel(array('contactForm' => $form->prepare()));
 }
开发者ID:bioub,项目名称:Formation_ZF2_OBS_2015_10,代码行数:11,代码来源:ContactController.php

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

示例8: getServer

 /**
  * (non-PHPdoc)
  * @see Tinebase_Server_Plugin_Interface::getServer()
  */
 public static function getServer(\Zend\Http\Request $request)
 {
     /**************************** JSON API *****************************/
     if ($request->getHeaders('X-TINE20-REQUEST-TYPE') && $request->getHeaders('X-TINE20-REQUEST-TYPE')->getFieldValue() === 'JSON' || $request->getHeaders('CONTENT-TYPE') && substr($request->getHeaders('CONTENT-TYPE')->getFieldValue(), 0, 16) === 'application/json' || $request->getPost('requestType') === 'JSON' || $request->getHeaders('ACCESS-CONTROL-REQUEST-METHOD')) {
         return new Tinebase_Server_Json();
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:11,代码来源:Json.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: init

 public function init(Request $request)
 {
     if (!$request->isXmlHttpRequest() || !$request->isPost()) {
         $this->noAccess();
     }
     $this->post = $request->getPost();
 }
开发者ID:visinoiu,项目名称:WarehouseTask,代码行数:7,代码来源:AjaxLibrary.php

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

示例12: page

 public function page()
 {
     $pageSize = current($this->getPageSizes());
     if (in_array((int) $this->request->getPost('pageSize'), $this->getPageSizes())) {
         $pageSize = (int) $this->request->getPost('pageSize');
     }
     return ['take' => (int) $this->request->getPost('take'), 'page' => (int) $this->request->getPost('page', 1), 'pageSize' => $pageSize];
 }
开发者ID:moln,项目名称:gzfextra,代码行数:8,代码来源:Kendo.php

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

示例14: requestSintegra

 /**
  * Makes a query for a CNPJ
  *
  * @param $cnpj
  * @return bool|mixed
  */
 public function requestSintegra($cnpj)
 {
     $request = new Request();
     $request->setMethod(Request::METHOD_POST);
     $request->setUri('http://www.sintegra.es.gov.br/resultado.php');
     $request->getPost()->set('botao', 'Consultar');
     $request->getPost()->set('num_cnpj', $cnpj);
     $client = new Client(null, self::setConfig());
     try {
         $response = $client->send($request);
         if ($response->getStatusCode() == 200) {
             return $response->getContent();
         }
         return false;
     } catch (\Exception $e) {
         return false;
     }
 }
开发者ID:GilTSN,项目名称:sample_rest_app,代码行数:24,代码来源:RequestSintegraService.php

示例15: testBodyAccessTokenProxiesOAuthServer

 /**
  * @dataProvider requestMethodsWithRequestBodies
  */
 public function testBodyAccessTokenProxiesOAuthServer($method)
 {
     $token = ['user_id' => 'test'];
     $this->setupMockOAuth2Server($token);
     $this->request->setMethod($method);
     $this->request->getHeaders()->addHeaderLine('Content-Type', 'application/x-www-form-urlencoded');
     $this->request->getPost()->set('access_token', 'TOKEN');
     $identity = $this->listener->__invoke($this->mvcAuthEvent);
     $this->assertIdentityMatchesToken($token, $identity);
 }
开发者ID:zfcampus,项目名称:zf-mvc-auth,代码行数:13,代码来源:DefaultAuthenticationListenerTest.php


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