TimestampBehavior::className(), 'attributes' => [ # 创建之前 ActiveRecord::EVENT_BEFORE_INSERT => ['create_at'], # 修改之前 //ActiveRecord::EVENT_BEFORE_UPDATE => ['update_at'] ], #设置默认值 'value' => $_SERVER['REQUEST_TIME'] ] ]; } public function FingByIp($ip,$hid) { return self::find()->andWhere(['ip'=>$ip])->andWhere(['hid'=>$hid])->exists(); } }