升级thinkphp到5.1.39

This commit is contained in:
cxdbz committed 2019-11-28 19:33:13 +08:00
1 parent c8839fa4f8
commit a58d04e7e2
37 files changed
+546 -192

No files matched your search

+13 -5
View File
@@ -130,7 +130,9 @@ class Url
// 匹配路由命名标识
$url = $match[0];
$domain = $match[1];
if ($domain) {
$domain = $match[1];
}
if (!is_null($match[2])) {
$suffix = $match[2];
@@ -347,6 +349,7 @@ class Url
// 匹配路由地址
public function getRuleUrl($rule, &$vars = [], $allowDomain = '')
{
$port = $this->app['request']->port();
foreach ($rule as $item) {
list($url, $pattern, $domain, $suffix, $method) = $item;
@@ -354,8 +357,8 @@ class Url
continue;
}
if (!in_array($this->app['request']->port(), [80, 443])) {
$domain .= ':' . $this->app['request']->port();
if ($port && !in_array($port, [80, 443])) {
$domain .= ':' . $port;
}
if (empty($pattern)) {
@@ -363,11 +366,12 @@ class Url
}
$type = $this->config['url_common_param'];
$keys = [];
foreach ($pattern as $key => $val) {
if (isset($vars[$key])) {
$url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? $vars[$key] : urlencode($vars[$key]), $url);
unset($vars[$key]);
$url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? $vars[$key] : urlencode($vars[$key]), $url);
$keys[] = $key;
$url = str_replace(['/?', '-?'], ['/', '-'], $url);
$result = [rtrim($url, '?/-'), $domain, $suffix];
} elseif (2 == $val) {
@@ -375,10 +379,14 @@ class Url
$url = str_replace(['/?', '-?'], ['/', '-'], $url);
$result = [rtrim($url, '?/-'), $domain, $suffix];
} else {
$result = null;
$keys = [];
break;
}
}
$vars = array_diff_key($vars, array_flip($keys));
if (isset($result)) {
return $result;
}