lib/adapter/Simple.php
private function buildUrL($uri, array $vars = [], $query = '', $fragment = '', $fullUrl = false) 
    {
        // 构造URL： $mod.$ctl.$act/$act_params/$key1:$val1/$key2:$val2[/...].$ext?$query#$fragment
        $url = trim($uri, '/');
        
        // URL简短化前从URL中获取mod,ctl
        $mod = '';
        $ctl = '';
        if (preg_match("/(.+?)\\.(.+)\\.(.+?)/", strtolower($url), $mat)) {
            $mod = $mat[1];
            $ctl = $mat[2];
        } elseif (preg_match("/(.+?)\\.(.+)/", strtolower($url), $mat)) {
            $ctl = $mat[1];
        }

        // URL简短化
        foreach ($this->cfg['alias'] as $shortTag => $rule) {
            $rule = trim($rule, '/');
            if (stripos($url.'/', $rule.'/') === 0) {
                $url = $shortTag . substr($url, strlen($rule));
                break;
            }
        }
        
        // 增加变量
        if (!empty($vars)) {
            $url .= '/' . str_replace("=", ':', http_build_query($vars, '', '/'));
        }
        
        // 对URL进行编码
        if ($this->cfg['encode']) {
            $url = 'q_' . strtr(base64_encode($url), '+/', '-_');
            $url = rtrim($url, '=');
        }
        
        // 加上伪静态后缀（不论是否启用URL Rewrite）
        $url && $url .= $this->cfg['rewriteExt'];
        
        // 未启用url重写，补充base url
        if(!$this->cfg['rewrite']) {
            $url = "{$this->cfg['scriptName']}?{$url}";
        }
        
        $modAndCtl = trim("{$mod}.{$ctl}", '.');
        
        if ($modAndCtl && isset($this->cfg['domain'][$modAndCtl])) {
            // 控制器指定域名
            $url = rtrim($this->cfg['basePath'], '/') . '/' . trim($url, '/');
            $url = rtrim($this->cfg['domain'][$modAndCtl], '/') . '/' . trim($url, '/');
        } elseif ($mod && isset($this->cfg['domain'][$mod])) {
            // 模块指定域名
            $url = rtrim($this->cfg['basePath'], '/') . '/' . trim($url, '/');
            $url = rtrim($this->cfg['domain'][$mod], '/') . '/' . trim($url, '/');
        } elseif ($fullUrl || $this->cfg['fullUrl']) {
            // 带域名的完整URL
            if ($this->cfg['siteUrl']) {
                $url = rtrim($this->cfg['siteUrl'], '/') . '/' . trim($url, '/');
            } else {
                $url = rtrim($this->cfg['basePath'], '/') . '/' . trim($url, '/');
                $url = rtrim($this->cfg['hostInfo'], '/') . '/' . trim($url, '/');
            }
        }

        // 查询串
        if (!empty($query)) {
            $url .= (strpos($url, '?') ? '&' : '?') . $query;
        }
        
        // 还原锚
        if (!empty($fragment)) {
            $url .= '#' . $fragment;
        }
        
        return $url;
    }
private function buildUrL($uri, array $vars = [], $query = '', $fragment = '', $fullUrl = false) 
    {
        // 构造URL： $mod.$ctl.$act/$act_params/$key1:$val1/$key2:$val2[/...].$ext?$query#$fragment
        $url = trim($uri, '/');
        
        // URL简短化前从URL中获取mod,ctl
        $mod = '';
        $ctl = '';
        if (preg_match("/(.+?)\\.(.+)\\.(.+?)/", strtolower($url), $mat)) {
            $mod = $mat[1];
            $ctl = $mat[2];
        } elseif (preg_match("/(.+?)\\.(.+)/", strtolower($url), $mat)) {
            $ctl = $mat[1];
        }

        // URL简短化
        foreach ($this->cfg['alias'] as $shortTag => $rule) {
            $rule = trim($rule, '/');
            if (stripos($url.'/', $rule.'/') === 0) {
                $url = $shortTag . substr($url, strlen($rule));
                break;
            }
        }
        
        // 增加变量
        if (!empty($vars)) {
            $url .= '/' . str_replace("=", ':', http_build_query($vars, '', '/'));
        }
        
        // 对URL进行编码
        if ($this->cfg['encode']) {
            $url = 'q_' . strtr(base64_encode($url), '+/', '-_');
            $url = rtrim($url, '=');
        }
        
        // 加上伪静态后缀（不论是否启用URL Rewrite）
        $url && $url .= $this->cfg['rewriteExt'];
        
        // 未启用url重写，补充base url
        if(!$this->cfg['rewrite']) {
            $url = "{$this->cfg['scriptName']}?{$url}";
        }
        
        $modAndCtl = trim("{$mod}.{$ctl}", '.');
        
        if ($modAndCtl && isset($this->cfg['domain'][$modAndCtl])) {
            // 控制器指定域名
            $url = rtrim($this->cfg['basePath'], '/') . '/' . trim($url, '/');
            $url = rtrim($this->cfg['domain'][$modAndCtl], '/') . '/' . trim($url, '/');
        } elseif ($mod && isset($this->cfg['domain'][$mod])) {
            // 模块指定域名
            $url = rtrim($this->cfg['basePath'], '/') . '/' . trim($url, '/');
            $url = rtrim($this->cfg['domain'][$mod], '/') . '/' . trim($url, '/');
        } elseif ($fullUrl || $this->cfg['fullUrl']) {
            // 带域名的完整URL
            if ($this->cfg['siteUrl']) {
                $url = rtrim($this->cfg['siteUrl'], '/') . '/' . trim($url, '/');
            } else {
                $url = rtrim($this->cfg['basePath'], '/') . '/' . trim($url, '/');
                $url = rtrim($this->cfg['hostInfo'], '/') . '/' . trim($url, '/');
            }
        }

        // 查询串
        if (!empty($query)) {
            $url .= (strpos($url, '?') ? '&' : '?') . $query;
        }
        
        // 还原锚
        if (!empty($fragment)) {
            $url .= '#' . $fragment;
        }
        
        return $url;
    }
生成URL
@param string $uri  $mod.$ctl.$act/$act_params/$key1:$val1/$key2:$val2[/...]
@param array $vars = []  参数
@param string $query = '' 查询串
@param string $fragment = ''  锚点
@param bool $fullUrl = false 是否生成完整URL，包含域名和根目录路径
@return string