Eon thinkphp Handout thinkphp--auto complete [14]

Source: Internet
Author: User

C Layer:

 Public functionLogin_two () {$person=d (' person '); $data[' user_id '] = ' 28 '; $data[' name '] = '; $data[' password '] = ' 111111 '; //$data [' repassword '] = ' 12345 ';        if($person->create ($data)){            $person-Save (); }Else {             Var_dump($person-GetError ()); }    }

M Layer:

//Auto-Complete    protected $_auto=Array(        //The string type can omit the following two        Array(' remark ', ' remarks '),//function , password encryption, encryption type SHA1,SHA1 function PHP built-in (SHA1 is the number ' 1 ' is not the letter ' L ')        Array(' Password ', ' SHA1 ', 3, ' function '),//populate the User field with the value of the email field        Array(' remark ', ' name ', 3, ' field '),//callback, custom methods such as: prefix the user name        Array(' name ', ' UpdateName ', 3, ' callback ', ' Hotel_ '),//Ignore, ignoring changes when the password is left blank for modification        Array(' name ', ' ', 2, ' ignore '),    ); //Custom Callback Functions        protected functionUpdateName ($str,$prefix){            return $prefix.$str; }

The meaning of automatic completion (unknown sensation ... ):

Auto-Completion is a method that thinkphp provides for automatic data processing and filtering, and data processing is done automatically when the Create method is used.

Therefore, it is more secure to use the Create method in thinkphp for creating data objects, rather than implementing data writes directly through the Add or save methods.

Eon thinkphp Handout thinkphp--auto complete [14]

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.