[英]Redirect is not working in cakephp after registration
function signup(){
if(!empty($this->data)){
if(isset($this->data['User']['password2']))
$this->data['User']['password2hashed'] = $this->
Auth->password($this->data['User']['password2']);
$this->User->create();
if($this->User->save($this->data)){
$this->Session->setFlash('Congratulatios, you have signed up');
$this->redirect('updateProfile');
}
{
$this->Session->setFlash('There was an error signing up, Please try again later');
$this->data= null;
}
}
}
请帮助我,我在做什么错,我是Cakephp的新手,谢谢
您忘记设置重定向之前的返回值
return $this->redirect(
array('controller' => 'users', 'action' => 'updateProfile')
);
$this->redirect('updateProfile'); //this is wrong
一定是:
return $this->redirect("/users/updateProfile");
要么:
return $this->redirect("updateProfile");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.