内核更新升级
This commit is contained in:
+12
-23
@@ -78,9 +78,9 @@ class Url
|
||||
}
|
||||
|
||||
// 检测URL绑定
|
||||
$type = Route::bind('type');
|
||||
$type = Route::getBind('type');
|
||||
if ($type) {
|
||||
$bind = Route::bind($type);
|
||||
$bind = Route::getBind($type);
|
||||
if (0 === strpos($url, $bind)) {
|
||||
$url = substr($url, strlen($bind) + 1);
|
||||
}
|
||||
@@ -153,9 +153,10 @@ class Url
|
||||
protected static function parseDomain(&$url, $domain)
|
||||
{
|
||||
if ($domain) {
|
||||
$request = Request::instance();
|
||||
if (true === $domain) {
|
||||
// 自动判断域名
|
||||
$domain = $_SERVER['HTTP_HOST'];
|
||||
$domain = $request->host();
|
||||
if (Config::get('url_domain_deploy')) {
|
||||
// 根域名
|
||||
$urlDomainRoot = Config::get('url_domain_root');
|
||||
@@ -184,9 +185,9 @@ class Url
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$domain .= strpos($domain, '.') ? '' : strstr($_SERVER['HTTP_HOST'], '.');
|
||||
$domain .= strpos($domain, '.') ? '' : strstr($request->host(), '.');
|
||||
}
|
||||
$domain = (self::isSsl() ? 'https://' : 'http://') . $domain;
|
||||
$domain = ($request->isSsl() ? 'https://' : 'http://') . $domain;
|
||||
} else {
|
||||
$domain = '';
|
||||
}
|
||||
@@ -217,20 +218,6 @@ class Url
|
||||
return (empty($suffix) || 0 === strpos($suffix, '.')) ? $suffix : '.' . $suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否SSL协议
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isSsl()
|
||||
{
|
||||
if (isset($_SERVER['HTTPS']) && ('1' == $_SERVER['HTTPS'] || 'on' == strtolower($_SERVER['HTTPS']))) {
|
||||
return true;
|
||||
} elseif (isset($_SERVER['SERVER_PORT']) && ('443' == $_SERVER['SERVER_PORT'])) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 匹配路由地址
|
||||
public static function getRouteUrl($alias, &$vars = [])
|
||||
{
|
||||
@@ -253,11 +240,13 @@ class Url
|
||||
}
|
||||
}
|
||||
$match = true;
|
||||
} elseif (empty($pattern) && array_intersect_assoc($param, $array) == $param) {
|
||||
$match = true;
|
||||
}
|
||||
if (empty($pattern) && empty($param)) {
|
||||
// 没有任何变量
|
||||
return $url;
|
||||
} elseif ($match && (empty($param) || array_intersect_assoc($param, $array) == $param)) {
|
||||
if (!empty($param) && array_intersect_assoc($param, $array) != $param) {
|
||||
$match = false;
|
||||
}
|
||||
if ($match) {
|
||||
// 存在变量定义
|
||||
$vars = array_diff_key($array, $param);
|
||||
return $url;
|
||||
|
||||
Reference in New Issue
Block a user