简体   繁体   中英

php cookies and browser not sending cookie to server

So I have a problem where this doesn't work.. the cookie file named "Main" exists in browser cache, but when I try the below code nothing is collected from it.

 if (isset($_COOKIE["Main"])){
 $user_cookie = $_COOKIE["Main"];
 }

Further digging shows I have another cookie for the same domain name that is part of a wikibridge...

both cookies have the same contents.. a username "John" exactly.

when I try

var_dump($_COOKIE); exit;

I get a bunch of array data, collected from the cookies my browser sends back, but it seems my browser firefox is not sending the "Main" cookie backm, its only sending a bunch of other cookies all part of the same domain name.

So despite this $_COOKIE["Main"] existing, it never gets sent back to the server for php to get it contents.

HELP

There are a few possible reasons for cookies of same domain not being sent.

First, I would check to see if the cookie is set as a secure cookie which is only sent for https requests.

Second, I would check if the cookie has a specific path that it is set to be active for and your request is not part of that path.

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