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 VerificationIsDatabase
A 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