$pat) { $rep_arr['{'.$name.'}'] = "(?P<$name>$pat)"; } $rep_arr['/'] = '\/'; $rep_arr['.'] = '\.'; $matches = array(); if (isset($route['domain'])) { $domain_pat = strtr($route['domain'], $rep_arr); if (!preg_match('/^'.$domain_pat.'$/', UOJContext::httpHost(), $domain_matches)) { return false; } $matches = array_merge($matches, $domain_matches); } $uri_pat = strtr($route['uri'], $rep_arr); if (!preg_match('/^'.$uri_pat.'$/', rtrim(UOJContext::requestPath(), '/'), $uri_matches)) { return false; } $matches = array_merge($matches, $uri_matches); foreach ($matches as $key => $val) { if (!is_numeric($key)) { $_GET[$key] = $val; } } return true; } }