Home Display
<! DOCTYPE html>ul{List-style-type:None;margin: 0;p Adding: 0; overflow:hidden;} li{float:Left ;} A: Link,a:Visited{display:Block;width:120px;font-weight:Bold;color:#FFFFFF;Background-color:#Bebebe;Text-align:center;padding:4px;text-decoration:None;text-transform:uppercase;} A: Hover,a:Active{background-color:#cc0000;}</style>foreachName= "div" item= "vo" ><div style=border-style:outset>User: {$vo.Username}</div><br> </foreach></body>Add page
<! DOCTYPE html>ul{List-style-type:None;margin: 0;p Adding: 0; overflow:hidden;} li{float:Left ;} A: Link,a:Visited{display:Block;width:120px;font-weight:Bold;color:#FFFFFF;Background-color:#Bebebe;Text-align:center;padding:4px;text-decoration:None;text-transform:uppercase;} A: Hover,a:Active{background-color:#cc0000;}</style>User name: <input type= "text" name= "name" ><br><br>Password: <input type= "text" name= "password" ><br><br><input type= "Submit" ></form></body >Delete Page
<! DOCTYPE html>ul{List-style-type:None;margin: 0;p Adding: 0; overflow:hidden;} li{float:Left ;} A: Link,a:Visited{display:Block;width:120px;font-weight:Bold;color:#FFFFFF;Background-color:#Bebebe;Text-align:center;padding:4px;text-decoration:None;text-transform:uppercase;} A: Hover,a:Active{background-color:#cc0000;}</style>foreachName= "div" item= "vo" ><div style=border-style:outset>User: {$vo. Username} <a href= "{: U (' Index/deldel ', Array (' username ' =$vo[' username '])} " > Delete this item </a></div><br> </foreach></body>Controller
<?PHP//This class is automatically generated by the system and is intended for testing purposes onlyclassIndexactionextendsAction {//Show Users Public functionindex () {Header("content-type:text/html; Charset=utf-8 ");$User= M ("user");//instantiating a model class $data=$User-Select ();$this->assign (' div ',$data); $this-display (); } Public functionAdd () {$this->display (' Tpl/add '); } Public functionAddadd () {$data["username"] =$_post[' Name '];//Receive user name$data["Encryptedpassword"] = I (' Password ', ' ', ' MD5 '));$data["CreationDate"]= Time();$data["Modificationdate"]= Time();$User= M (' user ');$User->add ($data);$t= Time();//$User = D ("user"), if ($vo = $User->create ()) {//if ($User->add ()) {//$this->success (' Add user Success ');//}else{//$ This->error (' Add user failed ');//}//}else{//$this->error ($User->geterror ());/}Echo' Now: '.Date(' y-m-d '). " \ n ";d UMP ($data);$this->redirect (' Index/add '); } Public functiondel () {Header("content-type:text/html; Charset=utf-8 ");$User= M ("user");//instantiating a model class $data=$User-Select ();$this->assign (' div ',$data); $this->display (' Tpl/del '); } Public functionDeldel () {$username= I (' username ');//Receive ID$del= M (' user ');$del->where ("username = '$username' ")Delete ();//Echo ' Delete succeeded! ';Dump$username);d UMP ($del);$this->redirect (' Index/del '); }}The setting device
<?PHPreturn Array( //' Config item ' = ' config value '//' USERNAME ' + ' admin ',//assignment//database configuration information' Db_type ' = ' mysql ',//Database Type' db_host ' = ' localhost ',//Server Address' Db_name ' = ' openfire ',//Database name' Db_user ' = ' root ',//User name' Db_pwd ' = ' root ',//Password' Db_port ' = 3306,//Port' Db_prefix ' = ' of ',//database table prefix//other project configuration Parameters//...);?>
Simple additions and deletions check skeleton