$val) { $_GET[$key] = $val; $_POST[$key] = $val; } } } } static private function parse_fromurl($squery,$method) { if(empty($squery)) return; $params = preg_split('/&/', $squery); if ($method == 'get' || $method == 'post') { foreach ($params as $pair) { if(empty($pair)) continue; $kv = explode('=', $pair); $count = count($kv); if($count === 1) { $key = $kv[0]; $val = ""; } elseif($count === 2) { $key = $kv[0]; $val = urldecode($kv[1]); } else { continue; } if(!empty($key)) { $_GET[$key] = $val; $_POST[$key] = $val; } Log::record("{$key}:{$val}",Log::DEBUG); } } } } function init_request() { request_helper::fill_server(); request_helper::fill_param(); } class local_request { private $script_file; private $query_string; private $method; public function __construct($uri) { $param = parse_url($uri); $this->script_file = BASE_ROOT_PATH . $param['path']; $this->query_string = $param['query']; $this->method = 'GET'; } public function script_file() { return $this->script_file; } public function query_string() { return $this->query_string; } public function method() { return $this->method; } } function init_localreq(local_request $req) { $squery = $req->query_string(); $params = preg_split('/&|=/', $squery); $method = strtolower($req->method()); if ($method == 'get' || $method == 'post') { for ($i = 0; $i < count($params); ++$i) { $key = $params[$i]; $val = $params[++$i]; $_GET[$key] = $val; $_POST[$key] = $val; } } }