hdeyin
在controller的Action中写的绑定事件,之后事件不会执行,
请问题主的controller继承的是哪个呢?我继承的是yii\web\Controller。
/*** @param string $id the ID of this controller. * @param Module $module the module that this controller belongs to. * @param array $config name-value pairs that will be used to initialize the object properties. */ public function __construct($id, $module, $config = []) { $this->id = $id; $this->module = $module; parent::__construct($config); }
@xiumei 根据我自己实测的经验,使用$this->on绑定并不会触发绑定事件,使用yii::$app->user->on的绑定可以正常触发登录事件
根据我自己实测的经验,使用$this->on绑定并不会触发绑定事件,使用yii::$app->user->on的绑定可以正常触发登录事件