0

发布此链接后仍然无法使其工作: 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;
4

1 回答 1

1

session_write_close在调用重定向之前尝试使用。或者我认为 Zend 有一个等价物,请参阅: Zend_Session::writeclose

唯一想到的其他事情(IE 是唯一给您带来麻烦的浏览器)是 P3P 策略。在这里查看 Talha 的帖子:Zend Sessions problem with IE8

于 2013-02-15T18:00:41.260 回答