當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Request::getCurrentRequest方法代碼示例

本文整理匯總了PHP中Symfony\Component\HttpFoundation\Request::getCurrentRequest方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::getCurrentRequest方法的具體用法?PHP Request::getCurrentRequest怎麽用?PHP Request::getCurrentRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\HttpFoundation\Request的用法示例。


在下文中一共展示了Request::getCurrentRequest方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onKernelRequest

 /**
  * Set the ip by listening on core.request.
  *
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     if (null === $this->requestStack) {
         return;
     }
     $request = $this->requestStack->getCurrentRequest();
     if (null === $request) {
         return;
     }
     $ip = $request->getClientIp();
     if (null !== $ip) {
         $this->ipTraceableListener->setIpValue($ip);
     }
 }
開發者ID:alexandre-t,項目名稱:pokeme,代碼行數:19,代碼來源:IpTraceSubscriber.php

示例2: getCurrentRequest

 private function getCurrentRequest()
 {
     if (null !== $this->requestStack) {
         if ($this->requestStack instanceof Request) {
             return $this->requestStack;
         } else {
             return $this->requestStack->getCurrentRequest();
         }
     }
     return $this->container->get('request');
 }
開發者ID:lutskanu,項目名稱:FOSOAuthServerBundle,代碼行數:11,代碼來源:AuthorizeFormHandler.php

示例3: getRequest

 /**
  * Returns the current Request.
  *
  * @return Request
  */
 protected function getRequest()
 {
     return $this->requestStack->getCurrentRequest();
 }
開發者ID:sulu,項目名稱:sulu,代碼行數:9,代碼來源:ListRestHelper.php

示例4: setRequest

 /**
  * @param RequestStack|Request $requestStack
  */
 public function setRequest($requestStack)
 {
     if ($requestStack instanceof Request) {
         $this->request = $requestStack;
     } elseif ($requestStack instanceof RequestStack) {
         $this->request = $requestStack->getCurrentRequest();
     } else {
         throw new \InvalidArgumentException('Argument 1 should be an instance of Symfony\\Component\\HttpFoundation\\RequestStack or Symfony\\Component\\HttpFoundation\\Request');
     }
 }
開發者ID:SmurfyFR,項目名稱:LexikJWTAuthenticationBundle,代碼行數:13,代碼來源:JWTManager.php

示例5: setRequest

 /**
  * @param RequestStack|Request $requestStack
  */
 public function setRequest($requestStack)
 {
     if ($requestStack instanceof Request) {
         $this->request = $requestStack;
     } elseif ($requestStack instanceof RequestStack) {
         $this->request = $requestStack->getCurrentRequest();
     }
 }
開發者ID:rbaraut,項目名稱:LexikJWTAuthenticationBundle,代碼行數:11,代碼來源:JWTManager.php


注:本文中的Symfony\Component\HttpFoundation\Request::getCurrentRequest方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。