src/Core/Router.php
public function getUriRequest($prefix = '/', &$url_config = array(), $clear_ampersand = true, $convert_html_entities = true)
    {
        $url_config = $this->config->get('url');
        if (!empty($this->uriRequest)) {
            return $this->uriRequest;
        }

        switch ($url_config['type']) {
            case 1:
            case 3:
                $request = Request::getInstance()->getQueryString();
                $this->originUriRequest = $request;

                if ($clear_ampersand) {
                    //rewrite下带问号的请求参数追加到$_GET数组
                    $request_uri = Request::getInstance()->getRequestURI();
                    if ($url_config['rewrite'] && $request_uri && false !== strpos($request_uri, '?')) {
                        $query_string = parse_url($request_uri, PHP_URL_QUERY);
                        parse_str($query_string, $addition_params);
                        $_GET += $addition_params;

                        if ($query_string == $request) {
                            $request = '';
                        }
                    }

                    if (false !== ($l = strpos($request, '&'))) {
                        $request = substr($request, 0, $l);
                    }

                    if (false !== strpos($request, '=')) {
                        $request = '';
                    }

                    if (isset($request[0]) && $request[0] != '&') {
                        array_shift($_GET);
                    }
                }
                break;

            case 2:
            case 4:
            case 5:
                $request = Request::getInstance()->getPathInfo();
                $this->originUriRequest = $request;
                break;

            default:
                throw new CoreException('Not support URL type!');
        }

        if ($request) {
            $request = urldecode(ltrim($request, '/'));
            if ($convert_html_entities) {
                $request = htmlspecialchars($request, ENT_QUOTES);
            }
        }

        return $prefix . $request;
    }
public function getUriRequest($prefix = '/', &$url_config = array(), $clear_ampersand = true, $convert_html_entities = true)
    {
        $url_config = $this->config->get('url');
        if (!empty($this->uriRequest)) {
            return $this->uriRequest;
        }

        switch ($url_config['type']) {
            case 1:
            case 3:
                $request = Request::getInstance()->getQueryString();
                $this->originUriRequest = $request;

                if ($clear_ampersand) {
                    //rewrite下带问号的请求参数追加到$_GET数组
                    $request_uri = Request::getInstance()->getRequestURI();
                    if ($url_config['rewrite'] && $request_uri && false !== strpos($request_uri, '?')) {
                        $query_string = parse_url($request_uri, PHP_URL_QUERY);
                        parse_str($query_string, $addition_params);
                        $_GET += $addition_params;

                        if ($query_string == $request) {
                            $request = '';
                        }
                    }

                    if (false !== ($l = strpos($request, '&'))) {
                        $request = substr($request, 0, $l);
                    }

                    if (false !== strpos($request, '=')) {
                        $request = '';
                    }

                    if (isset($request[0]) && $request[0] != '&') {
                        array_shift($_GET);
                    }
                }
                break;

            case 2:
            case 4:
            case 5:
                $request = Request::getInstance()->getPathInfo();
                $this->originUriRequest = $request;
                break;

            default:
                throw new CoreException('Not support URL type!');
        }

        if ($request) {
            $request = urldecode(ltrim($request, '/'));
            if ($convert_html_entities) {
                $request = htmlspecialchars($request, ENT_QUOTES);
            }
        }

        return $prefix . $request;
    }
按类型解析请求字符串

@param string $prefix
@param array $url_config
@param bool $clear_ampersand
@param bool $convert_html_entities
@return string
@throws CoreException