このリンクを投稿した後も動作しませんでした: Zend Framework セッションが失われました
ユーザーが登録してすぐに自分のページにリダイレクトできるようにする、このサインアップ フォームがあります。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;