Example #1
0
 /**
  * 匹配path
  * @param string $path
  * @param RouteInterface $route
  * @return boolean
  */
 protected function matchPath($path, RouteInterface $route)
 {
     //如果没有path则直接忽略
     if (empty($route->getPath())) {
         return true;
     }
     if (preg_match($route->compile()->getPathRegex(), rawurldecode($path), $matches)) {
         $routeParameters = array_intersect_key($matches, array_flip($route->getVariables()));
         $route->setParameter('_pathMatches', $routeParameters);
         return true;
     }
     return false;
 }