我在 magento 模态页面的会话中设置了数组变量,想在另一个页面(如 getuserdata.php)中检索但不进入另一个页面.我设置变量并进入一页然后完全检索.
I set array variable in session in magento modal page and want to retrieve in another page like getuserdata.php but not get in another page. I set variable and get in one page then in completely retrieve.
我的代码就像..
//第一页代码.
$session = Mage::getSingleton("core/session", array("name"=>"frontend"));
$fldata = 'work for set data';
$session->setData("free_auth", $fldata);
//另一个页面代码.
session_start();
require_once ("../../app/Mage.php");
umask(0);
Mage::app('default');
$session = Mage::getSingleton("core/session", array("name"=>"frontend"));
$stl1 = $session->getData("free_auth");
任何人都可以帮助我解决那个问题..
Anyone can help me for that stuff problem..
如果我们在 Magento 中创建会话,那么我们只能在 Magento 文件中使用该会话,例如在 magento/app 文件夹中.如果您想在您创建的外部文件中使用该会话,那么您必须首先在另一个 Magento 默认文件中获取该会话,然后调用 jquery ajax 函数并通过它传递会话变量以将其获取到外部文件中.您还可以在不使用会话的情况下通过 ajax 传递变量.
If we create a session in Magento, then we can only use that session in Magento files like in the magento/app folder. If you want to use that session in external files create by you then you must first get the session in another Magento default file and then call a jquery ajax function and pass session variable through it to get it in an external file. You also pass the variable through ajax without the use of the session.
像这样设置会话数据.
$fldata = 'work for set data';
Mage::getSingleton('core/session')->setMyCustomData($fldata);
并像这样获取数据.
session_start();
$sessionfree = Mage::getSingleton('core/session', array('name' => 'frontend'));
$abcfree = $sessionfree->getMyCustomData();
这篇关于在另一个页面中获取 magento 会话变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
在 SELECT(MYSQL/PHP) 中加入 2 个表Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 个表)
如何使<option selected=“selected">由How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 设置?)
使用 PHP 中的数组自动填充选择框Auto populate a select box using an array in PHP(使用 PHP 中的数组自动填充选择框)
PHP SQL SELECT where like search item with multiple wordsPHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode 从 MSSQL-SELECT 产生 JSON_ERROR_UTF8json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 从 MSSQL-SELECT 产生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(),名称 ASCMySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名称 ASC)