美文网首页
YII:Behavior

YII:Behavior

作者: zhang_xinglong | 来源:发表于2017-04-07 10:48 被阅读0次
    1. 类型
    • CModelBehavior 的 events:
      • afterConstruct
      • beforeValidate
      • afterValidate
    • CActiveRecordBehavior 的 events:
      • beforeSave
      • afterSave
      • beforeDelete
      • afterDelete
      • beforeFind
      • afterFind
      • beforeCount
    1. 实例

    CTimestampBehavior will automatically fill date and time related attributes when the active record is created and/or updated.You may specify an active record model to use this behavior like so:

    public function behaviors(){
        return array(
            'CTimestampBehavior' => array(
                'class' => 'zii.behaviors.CTimestampBehavior',
                'createAttribute' => 'create_time_attribute',
                'updateAttribute' => 'update_time_attribute',
            )
        );
      }
    

    相关文章

      网友评论

          本文标题:YII:Behavior

          本文链接:https://www.haomeiwen.com/subject/vjzcattx.html