Thinkphp Learning Notes (vii) the role of the Create method in instantiation, and the use of tokens
The success template, which can be found in the example in thinkphp, is then placed in public under the default under the TPL
Create uses
Before, the session and form have//tokens can be configured in the Conf, you can use the token without showing the token in the page setup
If there are multiple forms in the page, only one form requires a token, which can be specified in this form:
The CREATE default Fetch data method is the Post method Public Function index () {$this->display ();} Public function Add () {$user =new Model (' user ');////does not use the Create method to validate token//if (! $user->autochecktoken ($_post)) {//// Code for token validation failure;//$this->error ($user->geterror ());//}else{////Get information $user//$user->username;//$user USERNAME=MD5 ($user->password);////dump ($user);//if ($user->add ()) {//$this->success (' Add success ');//}else{//$ This->error ($user->geterror ());//}//}//returns the array information if auto-populated, returns the value and information more if ($vo = $user->create ()) {//// This method is a method of execution success, will give the page of various information//dump ($VO);////successs template can be found in thinkphp example, put into the public directory in the default//$this Success (' Create succeeded ');//Get Information $user$user->username=md5 ($user->password);//dump ($user); if ($user->add ()) { $this->success (' Add Success ');} else{$this->error ($user->geterror ());}} else {//If execution fails, the code will not continue to execute//dump ($VO);//dump ($user);//error template can be found in thinkphp example and placed in the public directory in default $this- >error ($user->geterror ());}}? >
Index.html
Curd