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


PHP Router::matchRequest方法代碼示例

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


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

示例1: onKernelRequest

 /**
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     if ($this->locale || $event->getRequestType() !== HttpKernelInterface::MASTER_REQUEST) {
         return;
     }
     // get route name from request
     $route = $this->router->matchRequest($event->getRequest());
     if (empty($route['_route'])) {
         return;
     }
     $route = $route['_route'];
     // go to the install page
     if ($route != 'install' && strpos($route, 'install_') !== 0) {
         $event->setResponse(new RedirectResponse($this->router->generate('install')));
     }
 }
開發者ID:anime-db,項目名稱:catalog-bundle,代碼行數:19,代碼來源:Request.php

示例2: matchRequest

 /**
  * @param Request $request
  * @return array
  */
 public function matchRequest(Request $request)
 {
     if (null !== $this->parent) {
         return $this->parent->matchRequest($request);
     }
     return parent::matchRequest($request);
 }
開發者ID:genedys,項目名稱:csrf-route-bundle,代碼行數:11,代碼來源:CsrfRouter.php

示例3: matchRequest

 /**
  * Tries to match a request with a set of routes.
  *
  * If the matcher can not find information, it must throw one of the exceptions documented
  * below.
  *
  * @param Request $request The request to match
  *
  * @return array An array of parameters
  *
  * @throws ResourceNotFoundException If no matching resource could be found
  * @throws MethodNotAllowedException If a matching resource was found but the request method is not allowed
  */
 public function matchRequest(Request $request)
 {
     try {
         $parameters = parent::matchRequest($request);
         $canonical = $request->getPathInfo();
     } catch (ResourceNotFoundException $e) {
         $alias = $this->getAliasRepo()->findOneBy(array('alias' => substr($request->getPathInfo(), 1)));
         if (!$alias) {
             throw $e;
         }
         $parameters = $this->getMatcher()->match('/' . $alias->getPath());
         $canonical = $alias->getPath();
     }
     return array_merge($parameters, array('_canonical' => $canonical));
 }
開發者ID:clastic,項目名稱:clastic,代碼行數:28,代碼來源:Router.php

示例4: matchRequest

 /**
  * @param Request $request
  * @return array
  */
 public function matchRequest(Request $request)
 {
     $this->setApiVersion();
     return parent::matchRequest($this->requestStack->getCurrentRequest());
 }
開發者ID:eliberty,項目名稱:api-bundle,代碼行數:9,代碼來源:ApiRouter.php

示例5: matchRequest

 /**
  * {@inheritdoc}
  */
 public function matchRequest(Request $request)
 {
     $match = parent::matchRequest($request);
     $this->setMatchContext($match);
     return $match;
 }
開發者ID:deantomasevic,項目名稱:multisite-bundle,代碼行數:9,代碼來源:MultisiteRouter.php

示例6: matchRequest

 /**
  * @param Request $request
  * @return array
  */
 public function matchRequest(Request $request)
 {
     $match = parent::matchRequest($request);
     return $this->processMatch($match);
 }
開發者ID:leapt,項目名稱:i18n-bundle,代碼行數:9,代碼來源:I18nRouter.php


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