//登陆页面
public function login(){
//已经登陆,跳到index操作
if($_SESSION['user']) $this->redirect('index');
/ /动态屏蔽表单令牌
C('TOKEN_ON',false);
//否则显示登陆页面
$this->display();
}
//登陆操作
public function checklogin(){
if(!IS_POST) $this->error('页面错误,请重试!');
C('TOKEN_ON',false);
$user = D("User");
if(!$user->create()){
$this->error($user->getError());
}
}在输出函数display前屏蔽了令牌,但是提交还是会报错,只有在checklogin()里面屏蔽令牌才可以不用令牌验证。不是表单里面没有令牌隐藏域就不会令牌验证的吗?
最佳答案