From c21a1b8b06c7f2f30450c85eca005b87e88e772e Mon Sep 17 00:00:00 2001 From: cjango Date: Sat, 23 Apr 2016 15:32:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9F=9F=E5=90=8D=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E6=83=85=E5=86=B5=E4=B8=8B=EF=BC=8Curl=E7=94=9F?= =?UTF-8?q?=E6=88=90=20=E5=A4=9A=E5=87=BAmodule=5Fname=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Url.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/library/think/Url.php b/library/think/Url.php index 20d6fec9..50d2c071 100644 --- a/library/think/Url.php +++ b/library/think/Url.php @@ -26,6 +26,9 @@ class Url */ public static function build($url = '', $vars = '', $suffix = true, $domain = false) { + if (is_bool($domain) && Config::get('url_domain_deploy')) { + $domain = true; + } // 解析URL $info = parse_url($url); $url = !empty($info['path']) ? $info['path'] : ''; @@ -101,7 +104,6 @@ class Url } else { $url .= $suffix . $anchor; } - // 检测域名 $domain = self::parseDomain($url, $domain); // URL组装 @@ -139,7 +141,7 @@ class Url } // 检测域名 - protected static function parseDomain($url, $domain) + protected static function parseDomain(&$url, $domain) { if ($domain) { if (true === $domain) { @@ -151,6 +153,7 @@ class Url foreach (Route::domain() as $key => $rule) { $rule = is_array($rule) ? $rule[0] : $rule; if (false === strpos($key, '*') && 0 === strpos($url, $rule)) { + $url = ltrim($url, $rule); $domain = $key . strstr($domain, '.'); // 生成对应子域名 break; }