src/Core/Rest.php
private function addCustomRouter($request_type, $custom_router, Closure $process_closure)
    {
        if ($this->request_type === $request_type) {
            $custom_router = trim($custom_router);
            $is_contain_params = preg_match_all("/(.*?)\{:(.*?)\}/", $custom_router, $params_keys);
            if ($is_contain_params) {
                $prefix_string_length = strlen($params_keys[1][0]);
                $compare = substr_compare($this->request_string, $custom_router, 0, $prefix_string_length);
                if ($compare === 0) {
                    $level = 'current';
                    if ($prefix_string_length == 1) {
                        $level = 'global';
                    }

                    $this->custom_router_config[$request_type][$level][$custom_router] = array(
                        'process_closure' => $process_closure,
                        'params_count' => count($params_keys[2]),
                        'params_key' => $params_keys[2],
                    );
                }
            } else {
                $this->custom_router_config[$request_type]['high'][$custom_router] = $process_closure;
            }
        }
    }
private function addCustomRouter($request_type, $custom_router, Closure $process_closure)
    {
        if ($this->request_type === $request_type) {
            $custom_router = trim($custom_router);
            $is_contain_params = preg_match_all("/(.*?)\{:(.*?)\}/", $custom_router, $params_keys);
            if ($is_contain_params) {
                $prefix_string_length = strlen($params_keys[1][0]);
                $compare = substr_compare($this->request_string, $custom_router, 0, $prefix_string_length);
                if ($compare === 0) {
                    $level = 'current';
                    if ($prefix_string_length == 1) {
                        $level = 'global';
                    }

                    $this->custom_router_config[$request_type][$level][$custom_router] = array(
                        'process_closure' => $process_closure,
                        'params_count' => count($params_keys[2]),
                        'params_key' => $params_keys[2],
                    );
                }
            } else {
                $this->custom_router_config[$request_type]['high'][$custom_router] = $process_closure;
            }
        }
    }
解析自定义路由并保存参数key

@param string $request_type
@param string $custom_router
@param Closure $process_closure