What is the difference between automatic verification and automatic completion in the TP framework ??

Source: Internet
Author: User
What is the difference between automatic verification and automatic completion in the TP framework ?? What is the difference between automatic verification and automatic completion in the TP framework ??

Reply content:

What is the difference between automatic verification and automatic completion in the TP framework ??

Automatic Verification)AndAutoOperation)AndAutoCheckToken)It is a function provided by the create method in the ThinkPHP framework.
That is to say, these methods are called only when you use create to create data objects.
Where,Automatic Verification)AndAutoOperation)The difference is:

/*** Create a data object but not save it to the database * @ access public * @ param mixed $ data create data * @ param string $ type status * @ return mixed */public function create ($ data = '', $ type = ''){...... // data is automatically verified if (! $ This-> autoValidation ($ data, $ type) return false ;...... // automatically process data after creation $ this-> autoOperation ($ data, $ type); // assign the value to the current data object $ this-> data = $ data; // return the created data for other calls return $ data ;}

Automatic Verification determines the data. If verification fails, the creation of the data object is terminated, while automatic completion automatically processes the data object and does not terminate the creation of the data object.

Is literally
Automatic Verification. for example, you must enter a field, email format, and mobile phone number format.
Automatic Completion. for example, the creation time is the current automatic time, and the password MD5 is automatically encrypted.

Automatic VerificationIsDatabaseA series of validation rules added at the model layer when writing data

Automatic CompletionWhen certain conditions are met, add the expected fields to the records to be inserted to the database, such as the update time and creation time.

I think you should learn Chinese first

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.