private function _validator() { if ($this->_username == '') { $this->error['username'] = '******'; return false; } $len = mb_strlen($this->_username, 'utf8'); $badCharactors = '`~!@#$%^&*()-=+[]{}\\|;:\'",.<>/?'; // 除_之外的其它字符 for ($i = 0, $n = strlen($badCharactors); $i < $n; ++$i) { if (strpos($this->_username, $badCharactors[$i]) !== false) { $this->error['username'] = '******'; return false; } } if ($len < 4 || $len > 20) { $this->error['username'] = '******'; return false; } if (UserNamespace::getUserInfo($this->_username)) { $this->error['username'] = '******'; return false; } $this->error['name'] = $this->_username; if ($this->_password == '') { $this->error['password'] = '******'; return false; } if ($this->_password != $this->_password2) { $this->error['password'] = '******'; return false; } if (strlen($this->_password) < 3 || strlen($this->_password) > 20) { $this->error['password'] = '******'; return false; } return true; }