Skip to content

Commit c8dc524

Browse files
committed
修正路由别名的参数获取
1 parent 16e0e98 commit c8dc524

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

library/think/route/Domain.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ protected function bindToClass($request, $url, $class)
161161
{
162162
$array = explode('|', $url, 2);
163163
$action = !empty($array[0]) ? $array[0] : $this->router->config('default_action');
164+
$param = [];
164165

165166
if (!empty($array[1])) {
166167
$this->parseUrlParams($request, $array[1], $param);
@@ -182,6 +183,7 @@ protected function bindToNamespace($request, $url, $namespace)
182183
$array = explode('|', $url, 3);
183184
$class = !empty($array[0]) ? $array[0] : $this->router->config('default_controller');
184185
$method = !empty($array[1]) ? $array[1] : $this->router->config('default_action');
186+
$param = [];
185187

186188
if (!empty($array[2])) {
187189
$this->parseUrlParams($request, $array[2], $param);
@@ -202,6 +204,7 @@ protected function bindToController($request, $url, $controller)
202204
{
203205
$array = explode('|', $url, 2);
204206
$action = !empty($array[0]) ? $array[0] : $this->router->config('default_action');
207+
$param = [];
205208

206209
if (!empty($array[1])) {
207210
$this->parseUrlParams($request, $array[1], $param);
@@ -222,6 +225,7 @@ protected function bindToModule($request, $url, $controller)
222225
{
223226
$array = explode('|', $url, 2);
224227
$action = !empty($array[0]) ? $array[0] : $this->router->config('default_action');
228+
$param = [];
225229

226230
if (!empty($array[1])) {
227231
$this->parseUrlParams($request, $array[1], $param);

library/think/route/dispatch/Module.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ public function exec()
114114
$vars = $this->rule->getConfig('url_param_type')
115115
? $this->request->route()
116116
: $this->request->param();
117+
$vars = array_merge($vars, $this->param);
117118
} elseif (is_callable([$instance, '_empty'])) {
118119
// 空操作
119120
$call = [$instance, '_empty'];

0 commit comments

Comments
 (0)