验证密码必须由字母和数组组成并且长度是6-30位

public function checkPassword($pwd) {
    	if (strlen($pwd)>30 || strlen($pwd)<6)
    	{
    		return array('status'=>false,'msg'=>$this->__('The length of password must be 6 to 30.'));
    	}
    	
    	if(preg_match("/^\d*$/",$pwd))
    	{
    		return array('status'=>false,'msg'=>$this->__('Password must contain letters.'));
    	}
    	 
    	if(preg_match("/^[a-z]*$/i",$pwd))
    	{
    		return array('status'=>false,'msg'=>$this->__('Passwords must contain Numbers.'));
    	}
    	 
    	if(!preg_match("/^[a-z\d]*$/i",$pwd))
    	{
    		return array('status'=>false,'msg'=>$this->__('Password can only contain Numbers and letters.'));		
    	}
    	return array('status'=>true,'msg'=>$this->__('right!'));
    }

 

你可能感兴趣的:(Magento,php,python,php,java)