因为原来用法会导致路由变量读取顺序问题,路由可选分隔符的用法 原来的

hello/<name>(-?)<id?>
改为:
hello/<name>-?<id?>
This commit is contained in:
thinkphp
2016-11-04 16:04:38 +08:00
parent dafca59498
commit 1a23e337e8

View File

@@ -81,7 +81,7 @@ class Url
// 匹配路由命名标识
$url = $match[0];
// 替换可选分隔符
$url = preg_replace(['/\((\W)\?\)$/', '/\((\W)\?\)/'], ['', '\1'], $url);
$url = preg_replace(['/(\W)\?$/', '/(\W)\?/'], ['', '\1'], $url);
if (!empty($match[1])) {
$domain = $match[1];
}