新增工具方法
This commit is contained in:
parent
056abcd9f1
commit
9dda665ddc
@ -87,4 +87,26 @@ class Utils
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析 Rule 规则
|
||||
*
|
||||
* @time 2020年05月06日
|
||||
* @param $rule
|
||||
* @return array
|
||||
*/
|
||||
public static function parseRule($rule)
|
||||
{
|
||||
[$controller, $action] = explode(Str::contains($rule, '@') ? '@' : '/', $rule);
|
||||
|
||||
$controller = explode('\\', $controller);
|
||||
|
||||
$controllerName = strtolower(array_pop($controller));
|
||||
|
||||
array_pop($controller);
|
||||
|
||||
$module = array_pop($controller);
|
||||
|
||||
return [$module, $controllerName, $action];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user