改进路由规则的组合变量定义的时候 可选分隔符的问题

支持使用 Route::rules('item-<name>(-?)<page?>','item/read');
This commit is contained in:
thinkphp
2016-10-09 23:31:51 +08:00
parent 107f272eb3
commit f50140bbe2

View File

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