src/MVC/View.php
protected function makeIndex(array $url_config, $have_controller = false)
    {
        static $cache = array();
        if (isset($cache[$have_controller])) {
            return $cache[$have_controller];
        }

        $index = $url_config['index'];
        $is_default_index = (0 === strcasecmp($index, 'index.php'));

        switch ($url_config['type']) {
            case 1:
            case 3:
                $index_dot = '?';
                $addition_dot = '/';
                if ($is_default_index) {
                    $index = '';
                }
                break;

            case 2:
            case 4:
            case 5:
                $index_dot = '/';
                $addition_dot = '';
                break;

            default:
                throw new CoreException('Type does not support!');
        }

        if ($url_config['rewrite']) {
            $index = $index_dot = $addition_dot = '';
        }

        $virtual_path = &$url_config['virtual_path'];
        if ($have_controller) {
            $index .= $index_dot . $addition_dot;
            if ($virtual_path) {
                $index .= $virtual_path . $url_config['dot'];
            }
        } else {
            if ($is_default_index) {
                $index = '';
            }

            if ($virtual_path) {
                $index .= $index_dot . $addition_dot . $virtual_path;
                if ($url_config['ext']) {
                    $index .= $url_config['ext'];
                }
            }
        }

        $cache[$have_controller] = $index;
        return $index;
    }
protected function makeIndex(array $url_config, $have_controller = false)
    {
        static $cache = array();
        if (isset($cache[$have_controller])) {
            return $cache[$have_controller];
        }

        $index = $url_config['index'];
        $is_default_index = (0 === strcasecmp($index, 'index.php'));

        switch ($url_config['type']) {
            case 1:
            case 3:
                $index_dot = '?';
                $addition_dot = '/';
                if ($is_default_index) {
                    $index = '';
                }
                break;

            case 2:
            case 4:
            case 5:
                $index_dot = '/';
                $addition_dot = '';
                break;

            default:
                throw new CoreException('Type does not support!');
        }

        if ($url_config['rewrite']) {
            $index = $index_dot = $addition_dot = '';
        }

        $virtual_path = &$url_config['virtual_path'];
        if ($have_controller) {
            $index .= $index_dot . $addition_dot;
            if ($virtual_path) {
                $index .= $virtual_path . $url_config['dot'];
            }
        } else {
            if ($is_default_index) {
                $index = '';
            }

            if ($virtual_path) {
                $index .= $index_dot . $addition_dot . $virtual_path;
                if ($url_config['ext']) {
                    $index .= $url_config['ext'];
                }
            }
        }

        $cache[$have_controller] = $index;
        return $index;
    }
生成URL中的索引部分

@param array $url_config
@param bool $have_controller
@return string
@throws CoreException