magento - 访问$ _SESSION

I have magento installed in a subdirectory /store

/ Main website /store Shop website

If I set a $_SESSION item in /, I can't access it within /store. I've print_r'd $_SESSION in /store and it has all the magento session keys there but not the key I've set in /

How can I access the $_SESSION item set in / ? I thought it would work because it's the same domain/server just a different folder.

Fist of all don't edit the index file. Use an event for adding something to the session.

controller_action_predispatch is dispatched before every Magento action for example. But you can use others also.

Second.
Don't use $_SESSSiON var.
Add something to the session like this:

 Mage::getSingleton('core/session')->setData('key_here', 'value_here');

To read it from the session do this:

 Mage::getSingleton('core/session')->getData('key_here');

or if you want to retrieve the value and remove it from the session do this:

 Mage::getSingleton('core/session')->getData('key_here', true);