改进Url生成对完整域名的支持

This commit is contained in:
thinkphp
2017-02-25 17:04:01 +08:00
parent 7cb4636b07
commit 16b33bc372

View File

@@ -268,7 +268,7 @@ class Url
$host = $request->host(); $host = $request->host();
$rootDomain = substr_count($host, '.') > 1 ? substr(strstr($host, '.'), 1) : $host; $rootDomain = substr_count($host, '.') > 1 ? substr(strstr($host, '.'), 1) : $host;
} }
if (!strpos($domain, $rootDomain)) { if (substr_count($domain, '.') < 2 && !strpos($domain, $rootDomain)) {
$domain .= '.' . $rootDomain; $domain .= '.' . $rootDomain;
} }
} }