Php 将在magento外部创建的会话传递到magento站点

Php 将在magento外部创建的会话传递到magento站点,php,magento,Php,Magento,我正在创建一个应用程序,其中我希望在框架中完成一些部分,如yii2或CI,以及magento中的一些部分,因此我希望将在magento之外创建的会话传递给magento应用程序,反之亦然。 我想知道是否有可能完成此任务以及如何完成?是的,您可以在magento之外使用magento会话,这是以前解决的答案 您需要在文件中包含mage.php 像 嘿,shakir,有没有这样的链接。我是magento的初学者。你检查过这个解决方案了吗?它是否对你有效?是的,谷歌有很多例子。如果您从此解决方案中获得

我正在创建一个应用程序,其中我希望在框架中完成一些部分,如yii2或CI,以及magento中的一些部分,因此我希望将在magento之外创建的会话传递给magento应用程序,反之亦然。
我想知道是否有可能完成此任务以及如何完成?

是的,您可以在magento之外使用magento会话,这是以前解决的答案 您需要在文件中包含mage.php 像


嘿,shakir,有没有这样的链接。我是magento的初学者。你检查过这个解决方案了吗?它是否对你有效?是的,谷歌有很多例子。如果您从此解决方案中获得结果,您可以获得magento以外的任何内容。我没有获取当前会话,因此我始终重定向到登录页面。您是使用admin或frontend登录的?我是使用frontend登录的。
require_once ('app/Mage.php');
Mage::app(); 

// Define the path to the root of Magento installation.
define('ROOT', Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB));

// Obtain the general session and search for an item called 'customer_id'
$core_session = Mage::getSingleton('core/session', array('name' =>       'frontend'));
if(isset($coreSession['visitor_data']['customer_id'])){
$customerId = $coreSession['visitor_data']['customer_id'];
} else {
header('Location: '.ROOT.'customer/account/login/');
}

// Load the user session.
Mage::getSingleton('customer/session')->loginById($customerId);
$customerSession = Mage::getSingleton("customer/session");

// We verified that created successfully (not required)
if(!$customerSession->isLoggedIn()) {
header('Location: '.ROOT.'customer/account/login/');
}

// Load customer
$customer = $customerSession->getCustomer();

// We get cell phone
$telefono = $customer->getTelefonoMovil();