PHP开发实例大全(提高卷) 中文完整pdf扫描版[244MB]
//beforeSave()这个方法是yii自带的
public function beforeSave(){
if(parent::beforeSave()){
//$this->isNewRecord 是否为新添加用户(新纪录)
if($this->isNewRecord){
$this->password=$this->encypt($this->password);
}
return true;
}else{
return false;
}
}
//给密码进行md5加密
public function encypt($pass){
return md5($pass);
}
转载请注明:谷谷点程序 » yii 对新注册用户的密码进行加密