改进写法

This commit is contained in:
thinkphp
2015-12-20 10:59:42 +08:00
parent c070940b95
commit f1a02a74b3

View File

@@ -36,9 +36,8 @@ class Controller
}
// 前置操作方法
// 支持 ['action1','action2'] 或者 ['action1'=>['only'=>'index'],'action2'=>['except'=>'login']]
$list = $this->beforeActionList;
if ($list) {
foreach ($list as $method => $options) {
if ($this->beforeActionList) {
foreach ($this->beforeActionList as $method => $options) {
is_numeric($method) ?
$this->beforeAction($options) :
$this->beforeAction($method, $options);