src/MVC/View.php
protected function makeUri($app_name, $check_app_name, $controller = null, $params = null, $encrypt_params = null)
    {
        $uri = '';
        $enable_controller_cache = false;
        //在运行过程中,如果url的配置有变化,需要调用cleanLinkCache()来刷新缓存
        if (!isset(self::$url_config_cache[$app_name])) {
            $this_app_name = $app_name;
            if ($check_app_name) {
                $this_app_name = $this->getAppName();
            }

            if ($check_app_name && $app_name != $this_app_name) {
                $config = Config::load(APP_PATH_DIR . $app_name . DIRECTORY_SEPARATOR . 'init.php');
            } else {
                $config = $this->config;
            }

            $url_router_config = array(
                'url' => $config->get('url'),
                'router' => $config->get('router')
            );
            self::$url_config_cache[$app_name] = $url_router_config;
        } else {
            $enable_controller_cache = true;
            $url_router_config = self::$url_config_cache[$app_name];
        }

        $url_params = '';
        $has_controller_string = true;
        $url_controller = $this->makeControllerUri($app_name, $enable_controller_cache, $controller, $url_router_config);
        if ($url_controller === '') {
            $has_controller_string = false;
        }

        $url_config = &$url_router_config['url'];
        if (!empty($params)) {
            $url_params = $this->makeParams($params, $url_config, $encrypt_params, $has_controller_string);
        }

        if (!empty($url_config['ext'])) {
            switch ($url_config['type']) {
                case 2:
                    if ($has_controller_string) {
                        $uri .= $url_controller . $url_config['ext'];
                    }

                    $uri .= $url_params;
                    break;
                case 1:
                case 3:
                case 4:
                case 5:
                    $uri .= $url_controller . $url_params . $url_config['ext'];
                    break;
            }
        } else {
            $uri .= $url_controller . $url_params;
        }

        return $uri;
    }
protected function makeUri($app_name, $check_app_name, $controller = null, $params = null, $encrypt_params = null)
    {
        $uri = '';
        $enable_controller_cache = false;
        //在运行过程中,如果url的配置有变化,需要调用cleanLinkCache()来刷新缓存
        if (!isset(self::$url_config_cache[$app_name])) {
            $this_app_name = $app_name;
            if ($check_app_name) {
                $this_app_name = $this->getAppName();
            }

            if ($check_app_name && $app_name != $this_app_name) {
                $config = Config::load(APP_PATH_DIR . $app_name . DIRECTORY_SEPARATOR . 'init.php');
            } else {
                $config = $this->config;
            }

            $url_router_config = array(
                'url' => $config->get('url'),
                'router' => $config->get('router')
            );
            self::$url_config_cache[$app_name] = $url_router_config;
        } else {
            $enable_controller_cache = true;
            $url_router_config = self::$url_config_cache[$app_name];
        }

        $url_params = '';
        $has_controller_string = true;
        $url_controller = $this->makeControllerUri($app_name, $enable_controller_cache, $controller, $url_router_config);
        if ($url_controller === '') {
            $has_controller_string = false;
        }

        $url_config = &$url_router_config['url'];
        if (!empty($params)) {
            $url_params = $this->makeParams($params, $url_config, $encrypt_params, $has_controller_string);
        }

        if (!empty($url_config['ext'])) {
            switch ($url_config['type']) {
                case 2:
                    if ($has_controller_string) {
                        $uri .= $url_controller . $url_config['ext'];
                    }

                    $uri .= $url_params;
                    break;
                case 1:
                case 3:
                case 4:
                case 5:
                    $uri .= $url_controller . $url_params . $url_config['ext'];
                    break;
            }
        } else {
            $uri .= $url_controller . $url_params;
        }

        return $uri;
    }
生成连接

@param string $app_name
@param bool $check_app_name
@param null|string $controller
@param null|array $params
@param null|bool $encrypt_params
@return string
@throws CoreException