在YII框架中,session持久化方法只需要调用login()方法就行了
class loginAction extends CAction{
function run(){
$model=new UserForm();
if(isset($_POST['UserForm'])){
//收集表单信息
$model->attributes=$_POST['UserForm'];
if($model->validate()&&$model->login()){
$this->getController()->redirect("./index.php?r=index/index");
}
}
$this->getController()->render("login",array("model"=>$model));
}
}