magento cookie无法正常工作 [英] magento cookies not working
本文介绍了magento cookie无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用
$id = 'WelcomeWindow';
$data = '1';
$time = time()+60*60*24*30;
Mage::getModel('core/cookie')->set($id, $data, $time);
并获取Cookie
$ data_from_cookie = 法师:: getModel('core/cookie')-> get('WelcomeWindow');
$data_from_cookie = Mage::getModel('core/cookie')->get('WelcomeWindow');
这种方法有效,但是-当我获取cookie时,直到我在管理区域中引用了Magento Cache时,它才显示值,
This kind of works but - when getting the cookie it doesn't show the value untill I refersh the Magento Cache within the admin area, is there a way around this?
推荐答案
由于某种原因,我已经将要执行的代码移至其他页面之前进行了排序,因此将其放置在在head.phtml的顶部,它似乎工作正常.
I've sorted it, for some reason I've moved the code to be executed before anything else is delivered to the page, so I placed it at the top of head.phtml and it seems to work fine.
这篇关于magento cookie无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文