在form表单提交页面的时候(既要显示,又可以修改提交)
public function personInfo(){
$user=M("UserInfo");
if(empty($_POST)){
$list=$user->where(array('uid'=>$_SESSION['uid']))->find();$this->list=$list;
$this->display();
} else{
//获取数据,验证数据,修改保存数据,读出数据
$email=I('post.email','');
$tel_phone=I('post.tel_phone','');
$gender=I('post.gender','');
//需要对数据检验
$arr=array(
'email' =>$email,
'tel_phone' =>$tel_phone,
'gender' =>$gender,
);
$user->where(array('uid'=>$_SESSION['uid']))->save($arr);
$list=$user->where(array('uid'=>$_SESSION['uid']))->find();
$this->list=$list;
// $this->display(); 使用这个后,页面只是会刷新而已,form表单里面post数据仍然在,
//所以不会进入到上面的判断,用下面的方法from表单数据则不存在
}
}