Skip to content

Commit 7bcf76d

Browse files
committed
some update
1 parent 6ddfc6a commit 7bcf76d

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

README_zh.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ $route = SRouter::match($path, $method);
299299
// 此路由的 handler callback
300300
'handler' => 'handler',
301301

302+
// (可能存在) 有参数匹配的路由匹配成功后,会将参数值放入这里
303+
'matches' => ['name' => value ],
304+
302305
// 此路由的自定义选项信息. 可能为空
303306
// - params - 来自添加路由时设置的参数匹配信息, 若有的话
304307
// - defaults - 有可选参数时,可以设置默认值
@@ -318,8 +321,6 @@ $route = SRouter::match($path, $method);
318321
// 'leave' => null,
319322
],
320323

321-
// (可能存在) 有参数匹配的路由匹配成功后,会将参数值放入这里
322-
'matches' => []
323324
],
324325
]
325326
```

src/AbstractRouter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ protected static function filterMatches(array $matches, array $conf)
101101
$matches = array_merge($conf['option']['defaults'], $matches);
102102
}
103103

104+
// decode ...
105+
// foreach ($matches as $k => $v) {
106+
// $matches[$k] = urldecode($v);
107+
// }
108+
104109
return $matches;
105110
}
106111

src/Dispatcher.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,9 @@ public function dispatch($path = null, $method = null, array $args = [])
166166
$options = $route['option'];
167167
unset($route['option']);
168168

169-
// schema,domains ... metadata validate
170-
if (false === $this->validateMetadata($options)) {
171-
return $result;
172-
}
173-
174169
// fire enter event
175-
if (isset($options['enter']) && false === $this->fireCallback($options['enter'], [$path])) {
170+
// schema,domains ... metadata validate
171+
if (isset($options['enter']) && false === $this->fireCallback($options['enter'], [$options, $path])) {
176172
return $result;
177173
}
178174

@@ -187,7 +183,7 @@ public function dispatch($path = null, $method = null, array $args = [])
187183

188184
// fire leave event
189185
if (isset($options['leave'])) {
190-
$this->fireCallback($options['leave'], [$path]);
186+
$this->fireCallback($options['leave'], [$options, $path]);
191187
}
192188

193189
// trigger route exec_end event

0 commit comments

Comments
 (0)