改进Route类的alias方法 改进Url类生成支持路由别名

This commit is contained in:
thinkphp
2016-06-09 09:00:42 +08:00
parent c4edb2e426
commit b50bcd5298
2 changed files with 22 additions and 13 deletions

View File

@@ -449,9 +449,11 @@ class Route
* @param array $option 路由参数
* @return void
*/
public static function alias($rule, $route = '', $option = [])
public static function alias($rule = null, $route = '', $option = [])
{
if (is_array($rule)) {
if (is_null($rule)) {
return self::$alias;
} elseif (is_array($rule)) {
self::$alias = array_merge(self::$alias, $rule);
} else {
self::$alias[$rule] = $option ? [$route, $option] : $route;