mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 23:52:49 +08:00
Merge pull request #51 from shenfakuan/master
修改在使用域名路由时,url方法结果不正确的bug(优化parseDomain)
This commit is contained in:
@@ -150,6 +150,9 @@ class Url
|
||||
if (Config::get('url_domain_deploy')) {
|
||||
// 根域名
|
||||
$urlDomainRoot = Config::get('url_domain_root');
|
||||
$route_domain = array_keys(Route::domain());
|
||||
foreach($route_domain as $domain_prefix) {
|
||||
if(strpos($domain, trim($domain_prefix, '*.')) !== false) {
|
||||
foreach (Route::domain() as $key => $rule) {
|
||||
$rule = is_array($rule) ? $rule[0] : $rule;
|
||||
if (false === strpos($key, '*') && 0 === strpos($url, $rule)) {
|
||||
@@ -161,7 +164,6 @@ class Url
|
||||
}
|
||||
break;
|
||||
}else if(false !== strpos($key, '*')){
|
||||
$domain = str_replace('*',strstr($domain,'.',true),$key);
|
||||
if(!empty($urlDomainRoot)){
|
||||
$domain .= $urlDomainRoot;
|
||||
}
|
||||
@@ -169,6 +171,8 @@ class Url
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$domain .= strpos($domain, '.') ? '' : strstr($_SERVER['HTTP_HOST'], '.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user