TimestampBehavior::className(), 'attributes' => [ # 创建之前 ActiveRecord::EVENT_BEFORE_INSERT => ['create_at', 'update_at'], # 修改之前 ActiveRecord::EVENT_BEFORE_UPDATE => ['update_at'] ], #设置默认值 'value' => $_SERVER['REQUEST_TIME'] ] ]; } public function setDelete($num) { $this->setDel = $num; } }