改进路由到类的方法的地址写法

This commit is contained in:
thinkphp
2016-06-07 18:46:07 +08:00
parent 451e7f0dda
commit 0b2359e856
2 changed files with 4 additions and 4 deletions

View File

@@ -1041,7 +1041,8 @@ class Route
$result = ['type' => 'redirect', 'url' => $url, 'status' => (is_array($route) && isset($route[1])) ? $route[1] : 301];
} elseif (0 === strpos($url, '\\')) {
// 路由到方法
$result = ['type' => 'method', 'method' => is_array($route) ? [$url, $route[1]] : $url, 'params' => $matches];
$method = strpos($url, '@') ? explode('@', $url) : $url;
$result = ['type' => 'method', 'method' => $method, 'params' => $matches];
} elseif (0 === strpos($url, '@')) {
// 路由到控制器
$result = ['type' => 'controller', 'controller' => substr($url, 1), 'params' => $matches];