改进路由解析的参数绑定

This commit is contained in:
thinkphp
2016-06-01 14:40:11 +08:00
parent 48ab620b34
commit bebe73e5a7

View File

@@ -1061,9 +1061,13 @@ class Route
private static function parseUrlParams($url, $var)
{
if ($url) {
preg_replace_callback('/(\w+)\/([^\/]+)/', function ($match) use (&$var) {
$var[strtolower($match[1])] = strip_tags($match[2]);
}, $url);
if (Config::get('url_param_type')) {
$var += explode('/', $url);
} else {
preg_replace_callback('/(\w+)\/([^\/]+)/', function ($match) use (&$var) {
$var[strtolower($match[1])] = strip_tags($match[2]);
}, $url);
}
}
$_GET = array_merge($var, $_GET);
}