1. Session Processing
Assignment: Session (' Name ', ' value ');//set SESSION with $_session[' think ' [' name '] = ' value '; equalValue:$value= Session (' name ');$value=$_session[' Think '] [' Name '];//sameDelete: Session (' Name ',NULL);unset($_session[' Think '] [' name ']);//sameEmpty: Session (NULL);unset($_session[' think ']);//sameJudgment: Session ('? name ');isset($_session[' Think '] [' name ']);//same
2, M Method:
Add:$User= M ("User");//instantiating a User object$data[' name '] = ' thinkphp ';$data[' email '] = ' [email protected] ';$User->add ($data), or$User->data ($data),add (); query:$User= M ("User");//instantiate the User object//Find the status value of 1 to create a time sort to return 10 data$list=$User->where (' Status=1 ')->order (' Create_time ')->limit (Ten)Select ();$User= M ("User");//instantiate the User object//Find the status value is 1name value of think data$User->where (' Status=1 and name= ' think ')->find ();//a piece of data$User= M ("User");//instantiate the User object//Get the ID and nickname list of all users$list=$User->getfield (' Id,nickname ');//Level Two array$this->getfield (' Id,name ', 5);//limit return 5 records$this->getfield (' id ', 3);//get ID Array limit 3 recordsUpdate:$User= M ("User");//instantiate the User object//Assign value to the data object property to be modified$data[' name '] = ' thinkphp ';$data[' email '] = ' [email protected] ';$User->where (' id=5 ')->save ($data);//save modified data based on conditions$User= M ("User");//instantiate the User object//Assign value to the data object property to be modified$data[' name '] = ' thinkphp ';$data[' email '] = ' [email protected] ';$User->where (' id=5 ')->data ($data)->save ();//save modified data based on conditions$User= M ("User");//instantiate the User object//change the name value$User--Where (' id=5 ')->setfield (' name ', ' thinkphp '));$User= M ("User");//instantiate the User object//change the value of the name and email$data=Array(' name ' = ' thinkphp ', ' email ' = ' [email protected] ');$User, where (' id=5 ')->setfield ($data);
tinkphp Simple Knowledge Summary