修正Url类域名部署的问题

This commit is contained in:
thinkphp
2016-10-26 08:29:25 +08:00
parent d96a037e49
commit 97fbbbc0e3

View File

@@ -29,7 +29,7 @@ class Url
* @param boolean|string $domain 是否显示域名 或者直接传入域名
* @return string
*/
public static function build($url = '', $vars = '', $suffix = true, $domain = false)
public static function build($url = '', $vars = '', $suffix = true, $domain = null)
{
if (false === $domain && Config::get('url_domain_deploy')) {
$domain = true;
@@ -172,13 +172,14 @@ class Url
} else {
// 解析到 模块/控制器/操作
$module = $request->module();
if (true === $domain) {
if (true === $domain && 2 == substr_count($url, '/')) {
$domains = Route::rules('domain');
foreach ($domains as $key => $item) {
if (isset($item['[bind]']) && 0 === strpos($url, $item['[bind]'][0])) {
$url = substr($url, strlen($item['[bind]'][0]) + 1);
$domain = $key;
$module = '';
break;
}
}
} elseif ($domain) {