Think/Route.php
private static function invokeRegx(Closure $closure, $var = [])
    {
        $reflect = new ReflectionFunction($closure);
        $params = $reflect->getParameters();
        $args = [];
        array_shift($var);
        foreach ($params as $param) {
            if (!empty($var)) {
                $args[] = array_shift($var);
            } elseif ($param->isDefaultValueAvailable()) {
                $args[] = $param->getDefaultValue();
            }
        }

        return $reflect->invokeArgs($args);
    }
private static function invokeRegx(Closure $closure, $var = [])
    {
        $reflect = new ReflectionFunction($closure);
        $params = $reflect->getParameters();
        $args = [];
        array_shift($var);
        foreach ($params as $param) {
            if (!empty($var)) {
                $args[] = array_shift($var);
            } elseif ($param->isDefaultValueAvailable()) {
                $args[] = $param->getDefaultValue();
            }
        }

        return $reflect->invokeArgs($args);
    }
执行正则匹配下的闭包方法 支持参数调用

@param   Closure $closure
@param array $var

@return mixed