PHP Framework-thinkphp Model automatic validation is invalid!!?

Source: Internet
Author: User
Tags php framework
I have customized a model class, which is set to $_validate but the automatic validation fails when the controller is applied. This is the original post, forgive me mobile phone client can not upload pictures, ask the big God pointing, I have been in this card for a long time, the original address http://tieba.baidu.com/p/4210433557

Reply content:

I have customized a model class, which is set to $_validate but the automatic validation fails when the controller is applied. This is the original post, forgive me mobile phone client can not upload pictures, ask the big God pointing, I have been in this card for a long time, the original address http://tieba.baidu.com/p/4210433557

Set to UserModel $patchValidate False in, set to True returns an array
Your use of exit () will naturally cause problems.

Dynamic verification is fine.

Before you exit,

Dump ($USR->create ());

Look at the output.

I see your duplicate password verification is not correct, should add the rule confirm, I use the problem is other non-empty what no problem, that is, duplicate password verification can not be used, and my duplicate password is written in the last side, I hope to help you.

A function that is generally static and then validated can be customized

You don't need a new instantiation, try it with the D method.

I said, I found the problem, but not necessarily in line with your situation, the model corresponding to the table, if not autogrow id,create validation will fail, create (update or INSERT flag) this should be able to

  • Related Article

    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.