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

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

Reply content:

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

自动验证(autoValidation)And 自动完成(autoOperation) , there 自动检测Token验证(autoCheckToken) is the function provided by the Create method inside the thinkphp framework.
That is, these methods are called only when you create a data object using create.
Among them, 自动验证(autoValidation) and 自动完成(autoOperation) different points are:

    /**     * 创建数据对象 但不保存到数据库     * @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;     }

Automatic validation determines the data and, if validation fails, terminates the creation of the data object, while auto-completion automatically processes the data object and does not terminate the creation of the data object.

That's literally what it means
Automatic verification, such as a field must fill in, mailbox format, cell phone number format and so on
Automatic completion, such as the creation time of the automatic current time, password MD5 automatic encryption and so on

Automatic Validation is a 数据库 series of validation rules added at the model level when writing to data

Auto-Completion is when a certain condition is met, you will be ready to add some of the fields you expect from the records inserted into the database, such as update time, creation time, etc.

I think you change to learn Chinese well 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.