I created cookies inside the root of my server.
setcookie("hs_aff", $_GET["aff_id"], time()+(3600 * 24 * 7), '/');
setcookie("hs_aff_ref", $_SERVER['HTTP_REFERER'], time()+(3600 * 24 * 7), '/');
It exists, and can be read in the root.
But then I moved to:
http://hafoslevy.cz/objednat-slevu/5219/celkove-kosmeticke-osetreni-pleti-ktere-obsahuje-odliceni-cisteni-ultrazvukove-spachtle-peeling-laser-masaz-maska-arganove-serum-kolagen-a-liftingovy-krem-to-vse-za-neskutecnych-332-kc
And when I called var_dump() here, I didn't get these two.
What's wrong with it?
Thanks.
You need to specifiy the domain. If it should work for ALL subdomains you should be good with':
setcookie("hs_aff", $_GET["aff_id"], time()+(3600 * 24 * 7), '/', '.yourdomain.tld');
setcookie("hs_aff_ref", $_SERVER['HTTP_REFERER'], time()+(3600 * 24 * 7), '/', '.yourdomain.tld');
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.