改进Url类

This commit is contained in:
thinkphp
2017-09-25 17:05:09 +08:00
parent 7b5be2f273
commit 902e786a73

View File

@@ -300,9 +300,10 @@ class Url
if (empty($pattern)) {
return [$url, $domain, $suffix];
}
$type = Config::get('url_common_param');
foreach ($pattern as $key => $val) {
if (isset($vars[$key])) {
$url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key . '', '<' . $key . '>'], urlencode($vars[$key]), $url);
$url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key . '', '<' . $key . '>'], $type ? $vars[$key] : urlencode($vars[$key]), $url);
unset($vars[$key]);
$result = [$url, $domain, $suffix];
} elseif (2 == $val) {