发布此链接后仍然无法使其工作: Zend framework session lost
我有这个注册表单,允许用户注册并将他们立即重定向到他们的页面。除了INTERNET EXPLORER之外,所有浏览器都可以正常工作。
我尝试了不同的方法,但仍然无法正常工作。将用户保存到数据库后,会话将不会存储。但是,如果我取出用户的保存,则可以存储会话和 cookie。
这是代码:
public function signUpAction()
{
$signupForm = new Application_Form_UserSignUp();
if ($this->getRequest()->isPost())
{
if ($signupForm->isValid($this->getRequest()->getParams()))
{
$user = $this->_helper->model('Users')->createRow($signupForm->getValues());
if ($user->save())
{
//Set email into cookies for displaying into login inputfield
setcookie('display_email', $this->getRequest()->getParam('email'), time() + 3600*24*30, '/'); <-- not working
Zend_Session::rememberMe(186400 * 14); <-- not working
Zend_Auth::getInstance()->getStorage()->write($user); <-- not working
$user->sendSignUpEmail(); <-- i'm receiving this email
$this->getHelper('redirector')->gotoRoute(array(), 'invite');
return;
}
}
}
$this->view->signupForm = $signupForm;
这是我正在做的另一种方式,但仍然无法在IE上运行:
public function signUpAction()
{
$users = new Application_Model_DbTable_Users();
$signupForm = new Application_Form_UserSignUp();
if ($this->getRequest()->isPost())
{
$firstname = $this->getRequest()->getParam('first_name');
$lastname = $this->getRequest()->getParam('last_name');
$email = $this->getRequest()->getParam('email');
if ($signupForm->isValid($this->getRequest()->getParams()))
{
$user = $this->_helper->model('Users')->createRow($signupForm->getValues());
$user = array('email' => $email, 'first_name' => $firstname, 'last_name' => $last_name);
$users->insert($user);
Zend_Session::rememberMe(186400 * 14);
Zend_Auth::getInstance()->getStorage()->write($user);
$this->_redirect('invite');
}
}
$this->view->signupForm = $signupForm;