1.应用设置
在配置文件中:
'as webAccess' => [ 'class' => 'app\components\filters\WebAccess',],
2.模块设置
在Module中重写behaviors方法:
public function behaviors(){ return [ 'access' => [ 'class' => WebAccess::className(), ] ];}
3.控制器设置
在控制器中重写behaviors方法:
public function behaviors(){ return [ 'access' => [ 'class' => WebAccess::className(), ] ];}