修正Route类的after_behavior和before_behavior行为调用

This commit is contained in:
thinkphp
2016-06-07 16:09:06 +08:00
parent e4fee11cca
commit ee7ef63c00
2 changed files with 5 additions and 4 deletions

View File

@@ -757,7 +757,7 @@ class Route
|| (isset($option['ext']) && false === stripos($option['ext'], $request->ext())) // 伪静态后缀检测
|| (isset($option['domain']) && !in_array($option['domain'], [$_SERVER['HTTP_HOST'], self::$subDomain])) // 域名检测
|| (!empty($option['https']) && !$request->isSsl()) // https检测
|| (!empty($option['before_behavior']) && false === Hook::exec($option['before_behavior'], $url)) // 行为检测
|| (!empty($option['before_behavior']) && false === Hook::exec($option['before_behavior'], '', $url)) // 行为检测
|| (!empty($option['callback']) && is_callable($option['callback']) && false === call_user_func($option['callback'])) // 自定义检测
) {
return false;
@@ -810,7 +810,7 @@ class Route
if ($option['after_behavior'] instanceof \Closure) {
$result = call_user_func_array($option['after_behavior'], [$route]);
} else {
$result = Hook::exec($option['after_behavior'], $route);
$result = Hook::exec($option['after_behavior'], '', $route);
}
// 路由规则重定向
if ($result instanceof Response) {