thinkphp Automatic Validation related notes

Source: Internet
Author: User

1. If a form token is added, the name of the form is consistent with the corresponding model field, otherwise the token of the pit daddy is wrong.

2. If a form token is added,create can only use the defaultPOST数据创建数据对象,不然又是坑爹的令牌错误。

The second parameter of the 3.create method specifies the state of the operation that creates the data, which is automatically determined by default as a write or update operation.

You can also explicitly specify an operation state, for example:

    1. $Member = M("User");
    2. // 指定更新数据操作状态
    3. $Member->create($_POST,Model::MODEL_UPDATE);

The system built-in data operations include Model::MODEL_INSERT (or 1) and Model::MODEL_UPDATE (or 2), when not specified, the system according to whether the data source contains primary key data to automatically determine, if there is primary key data, as the Model::MODEL_UPDATE operation.

thinkphp Automatic Validation related notes

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.