当前位置: 动力学知识库 > 问答 > 编程问答 >

php - How to access session or cookie variable on sub stores in Magento

问题描述:

I am trying to access my session or cookie variables on sub stores but didn't get any values there.I am trying like this :

 Mage::getModel('core/cookie')->set("foo","magento");

$_COOKIE['foo'] = "magento";

Mage::getSingleton('core/session')->setData("foo","magento");

When i try to access these variable on sub stores it returns empty result.I have created sub stores with multisite like http://example.com/ and http://example.com/secrondstore

I have created addson domain that link second store like this http://secondstore.com/.May be different stores with addon have effect on this

网友答案:

Possible duplicate of : PHP – setcookie() not working

You will need to use PHP's built in method to set cookies: setcookie, then use $_COOKIE[]=''

setcookie('foo', 'magento',time()+3600*24);
$_COOKIE['cookie'] = 'magento';
分享给朋友:
您可能感兴趣的文章:
随机阅读: