Example #1
0
 /**
  * 根据路径获取路由配置
  *
  * @param string $pathinfo
  */
 public function get($pathinfo)
 {
     if (!isset(Route::$regex[Core::$project])) {
         # 构造路由正则
         Route::init_regex();
     }
     # 当前Route
     $route = Core::config('route');
     foreach (Route::$regex[Core::$project] as $k => $v) {
         if (isset($route[$k]['for'])) {
             if ($route[$k]['for'] != Core::$project_url) {
                 # 如果路由不是为当前url设置的则或略
                 continue;
             }
         }
         $preg = Route::_matches($pathinfo, $k);
         if ($preg) {
             return $preg;
         }
     }
     return false;
 }