选择语言 :

 Core_Route::get

根据路径获取路由配置

null Core_Route::get( string $pathinfo )

参数列表

参数 类型 描述 默认值
$pathinfo string $pathinfo
File: ./core/classes/route.class.php
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;
}