The success template, which can be searched in example in thinkphp, and placed in public under the TPL default
Create uses
<?php class Curdaction extends action{//creation and additions and deletions to//create ()//creation will complete automatic mapping, autofill, Auto Verify///If the field cache is turned on, match the field, if it does not exist, get the field, and return An array//create method has an automatic token, and putting Md5 encrypted strings into the current session sessions will insert the string before </from> in the point form, with//tokens in session and form that can be configured in conf ; You can use the token <!--{__notoken__}-->//If there are multiple forms on the page, and only one form requires a token, you can display the specified:<!--in this form {__token__}-->//
Create defaults to get data by the Post method Public Function index () {$this->display ();
Public function Add () {$user =new Model (' user '); Do not use the Create method to validate token//if (! $user->autochecktoken ($_post)) {////token authentication failed code;//$this->error ($user->geterr
or ()); }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 ()); ////returned array information if used with AutoFill, return value and information more if ($vo = $user->create ()) {////This method is a method of executing successfully, giving a variety of information about the page/dump ($VO)
; Successs templates can be thinkphp in theFound in example, put into the public directory in default//$this->success (' create success ');
Obtain the 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 backward/dump ($VO);//dump ($user);
The error template can be found in the thinkphp example and placed into the public directory in default $this->error ($user->geterror ()); }}}?>
Index.html
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >