Typ3 删除 fe-user 的会话数据 [英] typo3 remove session data of fe-user
本文介绍了Typ3 删除 fe-user 的会话数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 Typ3 扩展程序,可以在会话中存储数据.
Hi I have an typo3 extension that stores data in session.
在我的操作完成后,我想删除会话数据.
After my actions are finished I want to remove the session data.
我试过了:
$GLOBALS['TSFE']->fe_user->removeSessionData();
但这行不通.
我的失败是什么?提前致谢
What is my fail? Thanks in advance
更新
if ( is_null($GLOBALS["TSFE"]->fe_user->getKey("ses", "Step1")) ) {
$this->redirect('noProductFound');
}
$arguments = $this->request->getArguments();
$reloadPage = new \TYPO3\ShopExtension\Controller\ShopStep();
$product = $arguments['product'];
$orderProcessed = $GLOBALS['TSFE']->fe_user->getKey('ses', 'orderProcessed');
#Verhindern das Seite neu geladen wird und eine neue Bestellung getätigt wird.
if ($reloadPage->getReload() == true | $orderProcessed == true) {
$this->redirect('noProductFound', null, null, array('error' => 'orderProcessed'));
} else {
if ($product == ShopConstant::AG_TRIAL) {
$this->save_Product_Trial();
$reloadPage->setReload(true);
$GLOBALS['TSFE']->fe_user->setKey('ses', 'orderProcessed', true);
$GLOBALS['TSFE']->storeSessionData();
} elseif ($product == ShopConstant::AG_PROFESSIONELL || $product == ShopConstant::AG_PREMIUM || $product == ShopConstant::AG_ULTIMATE) {
$afterOrderOrderId = $this->save_Product_Auditgarant($product);
$reloadPage->setReload(true);
$GLOBALS['TSFE']->fe_user->setKey('ses', 'orderProcessed', true);
$GLOBALS['TSFE']->storeSessionData();
} elseif ($product == ShopConstant::BOOK_AL || $product == ShopConstant::BOOK_PH || $product == ShopConstant::BOOK_CPMS || $product == ShopConstant::BOOK_USABILITY) {
$this->save_Product_Book($product);
$reloadPage->setReload(true);
$GLOBALS['TSFE']->fe_user->setKey('ses', 'orderProcessed', true);
$GLOBALS['TSFE']->storeSessionData();
} elseif ($product == ShopConstant::INSTITUTSTAG || $product == ShopConstant::INSTITUTSTAG_PARTNER || $product == ShopConstant::INSTITUTSTAG_ALUMNI) {
$this->save_Product_Institutstag($product);
$reloadPage->setReload(true);
$GLOBALS['TSFE']->fe_user->setKey('ses', 'orderProcessed', true);
$GLOBALS['TSFE']->storeSessionData();
} else {
$this->redirect('noProductFound');
}
#Session löschen, da Daten ab hier nicht mehr benötigt werden.
$GLOBALS['TSFE']->fe_user->removeSessionData();
$GLOBALS['TSFE']->fe_user->setKey('ses', 'Step1', null);
$GLOBALS['TSFE']->storeSessionData();
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($GLOBALS['TSFE']);
// exit();
#Führt einen redirect durch mit angehängtem Attribut des letzten Step.
$this->redirect('getContent', null, null, array(
'step' => $arguments['lastStep'],
'shopStep' => $arguments['product'],
'afterOrderOrderId' => $afterOrderOrderId
));
推荐答案
如果你做了 $GLOBALS['TSFE']->fe_user->setAndSaveSessionData('session_key', $somevalue);
你可以简单地执行 $GLOBALS['TSFE']->fe_user->setAndSaveSessionData('session_key', null);
来删除会话数据.
In case you did $GLOBALS['TSFE']->fe_user->setAndSaveSessionData('session_key', $somevalue);
you can simply do $GLOBALS['TSFE']->fe_user->setAndSaveSessionData('session_key', null);
to delete the session data.
这篇关于Typ3 删除 fe-user 的会话数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文