简体   繁体   中英

Cookies accessible from domain.com and www.domain.com

If I create a cookie using PHP as:

setcookie('pctlang',$setlocale,time()+3600*24*365,'/');

From domain.com, my users can access my site using also www.domain.com, but in that url the cookies created in domain.com are not accessible.

Is there any way to solve this?

尝试这个

setcookie('pctlang',$setlocale,time()+3600*24*365,'/',".domain.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