$v) { $k = str_replace(':any', '.+', str_replace(':num', '[0-9]+', $k)); if(preg_match('#^'.$k.'$#', self::$value)) { if(strpos($v, '$') !== false AND strpos($k, '(') !== false) { $v = preg_replace('#^'.$k.'$#', $v, self::$value); } self::$value = $v; self::$url = self::$value; } } self::input(); } } } /** * 将uri解析? * * @return string */ static private function input() { if(strpos(self::$value, '?') !== false) { $temp = explode('?', self::$value); self::$value = $temp[0]; parse_str($temp[1], $input); Input::set('all', $input); } } /** * 将uri解析成file * * @return string */ static public function file() { if(self::$method == 'GET' && !empty($_SERVER['REQUEST_URI'])) { $request_uri = strtoupper(urldecode($_SERVER['REQUEST_URI'])); if(strpos($request_uri, '<') !== false || strpos($request_uri, '"') !== false || strpos($request_uri, 'CONTENT-TRANSFER-ENCODING') !== false) { error(\Lang::get('request_tainting')); } unset($request_uri); } if(strpos(self::$value, self::explode) !== false) { $array = explode(self::explode, self::$value); if(isset($array[2]) && empty($array[3])) { $file = $array[0] . self::explode . $array[1] . self::explode . $array[2]; unset($array[0]); unset($array[1]); unset($array[2]); } elseif(isset($array[1])) { $file = $array[0] . self::explode . $array[1]; unset($array[0]); unset($array[1]); } elseif(isset($array[0])) { $file = $array[0]; unset($array[0]); } $param = array_values($array); } else { $file = self::$value; } return $file; } }