当前位置: 首页>>代码示例>>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;未经允许,请勿转载。