Questions about automatic validation of forms signed in with thinkphp members

Source: Internet
Author: User
Questions about automatic validation of forms signed in with thinkphp members?
My memberaction code is
 
  Class Memberaction extends action{
Public Function Insert ()
{
Header (' content-type:text/html; Charset=utf-8 ');
$Member = D (' developers ');
if ($Member->create ()) {
$result = $Member->add ();
if ($result) {
$this->success (' Registration successful! ');
}else{
$this->error (' Registration failed! ');
}
}else{
$this->error ($Member->geterror ());
}
}
}
?>


My Membermodel code is
 
  Class Membermodel extends Model {

protected $_validate = Array (
Array ("username", "require", "User name cannot be empty"),
Array (' username ', ' ', ' account name already exists! ', 0, ' unique ', 1),
Array ("username", "checklength", "username length does not meet requirements", 0, ' callback '),
Array (' name ', ' Require ', ' name must '),
Array ("Password", "Require", "Password cannot be empty"),
Array ("Password", "Checklength", "Password length requirements are between 5~15 bits", 0, ' callback '),
Array (' Repassword ', ' password ', ' two times password input inconsistent ', 0, ' confirm '),
);






}
?>


The problem is that it does not automatically verify, no matter what you fill in can register success, do not fill in the register is unsuccessful, do not know how to, ask you greatly

Share to:
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.