修改邮件时,自动验证提示手机号,邮件不合法,实际上确实是合法的//自动验证<br>
protected $_validate = array(<br>
//-1,账号长度不合法!<br>
array('username','/^[^@]{2,20}$/i',-1,self::EXISTS_VALIDATE),//默认为正则验证<br>
//-2,密码长度不合法!,新增模式<br>
array('password','6,30',-2,self::EXISTS_VALIDATE,'length', self::MODEL_BOTH),<br>
//-6,手机号不合法!<br>
array('phone','/^(0|86|17951)?(13[0-9]|15[012356789]|18[0-9]|14[57])[0-9]{8}$/',-6,self::EXISTS_VALIDATE),<br>
//-3,邮箱格式不正确<br>
array('email','email',-3,self::EXISTS_VALIDATE),<br>
//-4,账号被占用<br>
array('username', '', -4, self::EXISTS_VALIDATE, 'unique', self::MODEL_INSERT),<br>
//-7,手机号被占用<br>
array('phone','',-7,self::EXISTS_VALIDATE,'unique',self::MODEL_INSERT),<br>
//-5,邮箱被占用<br>
array('email','',-5,self::EXISTS_VALIDATE,'unique',self::MODEL_INSERT),<br>
);<br>
<br>
<br>
//修改会员信息<br>
public function update($id, $password, $phone, $email) {<br>
//用于验证<br>
$data = array(<br>
'id'=>$id,<br>
'phone'=>$phone,<br>
'email'=>$email,<br>
);<br>
<br>
//$password有值时才验证<br>
if($password){<br>
$data['password'] = $password;<br>
}<br>
<br>
if($this->create($data)) {<br>
$uid = $this->save();<br>
return (false !== $uid) ? $uid : 0;<br>
}else{<br>
return $this->getError();<br>
}<br>
}
QQ图片20150403114023.png ( 50.26 KB 下载:86 次 )
AD:真正免费,域名+虚机+企业邮箱=0元