doulu6160 2015-03-16 08:14
浏览 62

从其他目录中检索cookie

I have set cookie with the jQuery Cookied plugin and when I try to access it with the PHP, then it is not working.

Cookie has been set with the following code :

$.cookie("_culture", culture, { expires: 365, path: '/' });

And I tried to get it with $_COOKIE['_culture'] but it is not working.

I am not able to find the reason. But I think its DIRECTORY RELATED issue.Because if I try to get it through the same directory, then it works perfectly.

But when I tried it from other directory, then it is not working.

How can I make it accessible in all the directories ?

(I checked cookies and the cookie what I want to retrieve is present there.)

  • 写回答

1条回答 默认 最新

  • douxun4924 2015-03-16 08:59
    关注

    You should add a domain so it will be accessible from your root & subdirectories.

    $.cookie('_culture', culture, { expires: 365, path: '/', domain: 'example.com' });
    
    评论

报告相同问题?