renzhengchi
- renzhengchi 回复了 liangkaixin 的回复
我只知道插入的话可以在模型中写
public function behaviors(){return [ [ 'class' => AttributeBehavior::className(), 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => 'name', ], 'value' => function ($event) { return md5($this->name); }, ], ]; }
@liangkaixin behaviors确实没研究过 我研究下,有结论或问题再回复你^ ^