What is the role of confirm in ThinkPHP automatic verification rules?

Source: Internet
Author: User
Generally, the verification rules are written as follows: {code ...} if the fourth parameter is 0, it indicates that the repassword Column exists in the database, it will be verified, but the code written by myself does not know whether the Column exists in the database? If this column is not found, isn't there much Remainder of the validation rules? If you have this... the General validation rules are as follows:

// Verify that the password is consistent with the password array ('repassword', 'Password', 'confirm that the password is incorrect. ', 0, 'Confirm '),

If the fourth parameter is 0, it indicates that the repassword Column exists in the database, it will be verified, but the code written by myself does not know whether the Column exists in the database?

If this column is not found, isn't there much Remainder of the validation rules?

If this column exists, is it better to directly write 1 (verification required) as the parameter?

Another question is: do we need to store two identical passwords for the same user name in the database?

Reply content:

Generally, the verification rules are written as follows:

// Verify that the password is consistent with the password array ('repassword', 'Password', 'confirm that the password is incorrect. ', 0, 'Confirm '),

If the fourth parameter is 0, it indicates that the repassword Column exists in the database, it will be verified, but the code written by myself does not know whether the Column exists in the database?

If this column is not found, isn't there much Remainder of the validation rules?

If this column exists, is it better to directly write 1 (verification required) as the parameter?

Another question is: do we need to store two identical passwords for the same user name in the database?

The confirm field is not used for your database.
Generally, when a user registers or modifies a password, the user is allowed to enter the password twice.
The first is the password set by the user, and the second is the Password confirmed by the user.

The function of confirm is to verify whether the two fields in the form are the same
The 4th parameters have three optional values:

If the Model: EXISTS_VALIDATE or 0 field exists, it is verified (default) When Model: MUST_VALIDATE or 1 must be verified when Model: VALUE_VALIDATE or 2 is not null.

The existing field is not the data inventory field, but the name value of the control in the form. It is not the same concept as the field in the database.
By default, the control with the name value in the form is verified.

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.