简体   繁体   中英

Retrieve cookie from other directory

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.)

您应该添加一个域,以便可以从根目录和子目录访问该域。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM