Home >Backend Development >PHP Tutorial >What is the difference between autovalidation and autocomplete in TP framework? ?
What is the difference between auto-validation and auto-complete in TP framework? ?
What is the difference between auto-validation and auto-complete in TP framework? ?
AutoValidation
and AutoComplete (autoOperation)
, and Automatic Token Verification (autoCheckToken)
are functions provided by the create method in the ThinkPHP framework.
That is to say, only when you use create to create a data object These methods will only be called when.
Among them, the difference between automatic verification (autoValidation)
and automatic completion (autoOperation)
is:
<code> /** * 创建数据对象 但不保存到数据库 * @access public * @param mixed $data 创建数据 * @param string $type 状态 * @return mixed */ public function create($data='',$type='') { ... ... // 数据自动验证 if(!$this->autoValidation($data,$type)) return false; ... ... // 创建完成对数据进行自动处理 $this->autoOperation($data,$type); // 赋值当前数据对象 $this->data = $data; // 返回创建的数据以供其他调用 return $data; }</code>
Automatic verification will determine the data. If the verification fails, the creation of the data object will be terminated, while automatic completion will automatically process the data object and will not terminate the creation of the data object.
It means literally
Automatic verification, such as a certain field must be filled in, email format, mobile phone number format, etc.
Automatic completion, such as the creation time is automatically the current time, password MD5 is automatically encrypted, etc.
Automatic verification is a series of verification rules added to the model layer when writing data to the database
Automatic completion means that when certain conditions are met, some of the fields you expect will be added to the records inserted into the database, such as update time, creation time, etc.
I think you should change and learn Chinese first