【发布时间】:2014-12-22 16:42:20
【问题描述】:
我想从 Zend 框架(另一个应用程序)获取 Magento 会话。我需要 Zend Framework 中的应用程序验证管理员中的用户是否已登录(Magento)。我的 Zend Framework 应用程序中有以下代码:
// Initialize Magento
include_once 'C:/xampp/htdocs/mymagento/app/Mage.php';
// Initialize Magento
Mage::app('default');
// This initalizes the session, using 'adminhtml' as the session name.
// Just ignore the returned Mage_Core_Model_Session instance
Mage::getSingleton('core/session', array('name' => 'adminhtml'));
// Get a singleton instance of the Mage_Admin_Model_Session class
// This is just the 'admin' namespace of the current session. (adminhtml in this case)
$session = Mage::getSingleton('admin/session');
// Use the 'admin/session' object to check loggedIn status
if ( $session->isLoggedIn() ) {
echo "logged in";
} else {
echo "not logged in";
}
响应总是“未登录”;当我登录 Magento 后端时。
【问题讨论】:
标签: php magento zend-framework