phprs\util\HttpRouterEntries::insert PHP Method

insert() public method

增加一条规则
public insert ( $query, $e, $strict = false )
$query string 请求的url形式
$e mixed
$strict boolean 是否严格匹配
    public function insert($query, $e, $strict = false)
    {
        list($path, $param) = explode('?', $query) + array(null, null);
        $path = str_replace('\\', '/', $path);
        $paths = explode('/', $path);
        $route = null;
        $params = null;
        if ($param !== null && $param !== "") {
            $params = explode('&', $param);
        }
        if ($strict || !empty($params)) {
            $paths[] = Tree::$end;
            //对于严格匹配的路由规则(有querystring的路由,path部分也需要严格匹配),在路径末尾加入end,偏于匹配
        }
        return $this->insertByArray($paths, $params, $e);
    }