修正Url类路由分组的情况

This commit is contained in:
thinkphp
2016-05-10 11:57:35 +08:00
parent 054af31455
commit 6cec513b10

View File

@@ -150,10 +150,11 @@ class Url
if (Config::get('url_domain_deploy')) { if (Config::get('url_domain_deploy')) {
// 根域名 // 根域名
$urlDomainRoot = Config::get('url_domain_root'); $urlDomainRoot = Config::get('url_domain_root');
$route_domain = array_keys(Route::domain()); $domains = Route::domain();
$route_domain = array_keys($domains);
foreach ($route_domain as $domain_prefix) { foreach ($route_domain as $domain_prefix) {
if(strpos($domain, trim($domain_prefix, '*.')) !== false) { if (0 === strpos($domain_prefix, '*.') && strpos($domain, ltrim($domain_prefix, '*.')) !== false) {
foreach (Route::domain() as $key => $rule) { foreach ($domains as $key => $rule) {
$rule = is_array($rule) ? $rule[0] : $rule; $rule = is_array($rule) ? $rule[0] : $rule;
if (false === strpos($key, '*') && 0 === strpos($url, $rule)) { if (false === strpos($key, '*') && 0 === strpos($url, $rule)) {
$url = ltrim($url, $rule); $url = ltrim($url, $rule);
@@ -269,7 +270,9 @@ class Url
if (is_numeric($key)) { if (is_numeric($key)) {
$key = array_shift($route); $key = array_shift($route);
} }
if (is_array($route)) {
$route = $route[0]; $route = $route[0];
}
$param = []; $param = [];
if (is_array($route)) { if (is_array($route)) {
$route = implode('\\', $route); $route = implode('\\', $route);