【问题标题】:Get Magento Session in Directory that is outside Magento在 Magento 外部的目录中获取 Magento 会话
【发布时间】:2014-09-05 10:28:36
【问题描述】:

我想在我的 magento 主目录之外的目录中获取客户会话。例如root/magento/ => 是我的安装目录 root/temp/ => 是我的测试文件夹 root/checksession.php => 是magento安装根目录下的文件 root/temp/checksession.php => 是 magento 目录之外和外部目录内部的文件。 在这里,我在 root/checksession.php 中获取客户会话,但我不知道为什么相同的编码不适用于 root/temp/checksession.php 试过 include、define 和 php session 方法,还是不行。

有谁知道,如何在 root/temp/checksession.php 文件中获取 magento 会话???

require_once 'app/Mage.php';
Mage::app("default");
$coreSession = Mage::getSingleton('core/session', array('name' => 'frontend'));
session_start();
$_SESSION["coreSession"] = $coreSession;
echo "<pre>";print_r($coreSession);

【问题讨论】:

  • print_r($coreSession); 说什么?有没有错误?您是否包含如上所示的Mage.php 或喜欢require_once '../app/Mage.php';
  • 尝试添加error_reporting(E_ALL | E_STRICT); ini_set('html_errors', 1); Mage::setIsDeveloperMode(true); ini_set('display_errors', 1);
  • 我正在添加 require_once 'app/Mage.php';在根文件中,并且 require_once '../app/Mage.php';在临时目录文件中
  • 添加后 Mage::setIsDeveloperMode(true); ini_set('display_errors', 1); (!)致命错误:未捕获的异常“异常”,消息“警告:simplexml_load_string():

标签: magento session directory


【解决方案1】:

我想你忘记了以下几点:

Mage::app('admin')->setUseSessionInUrl(false);

【讨论】:

    猜你喜欢
    • 2012-06-24
    • 2012-03-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-16
    • 1970-01-01
    相关资源
    最近更新 更多