/** * 路由正则检查 * @param string $regx * @param string $route * @param array $matches */ public static function parse_url($regx, $route, $matches) { $url = is_array($route) ? $route[0] : $route; $url = preg_replace('/\\$(\\d+)/e', '$matches[\\1]', $url); //绝对路径或者http url则跳转 if (stripos($url, '/') === 0 || substr($url, 0, 4) == 'http://') { $http_code = is_array($route) && isset($route[1]) ? $route[1] : 301; header('Location: ' . $url, true, $http_code); exit; } else { $info = App_Url::info($url); App_Info::$CONTROLLER_NAME = $info['c_name']; App_Info::$ACTION_NAME = $info['a_name']; $_GET = array_merge($info['params'], $_GET); $_REQUEST = array_merge($info['params'], $_REQUEST); } }