O
O
Optimus2016-08-16 10:07:36
PHP
Optimus, 2016-08-16 10:07:36

Do domain cookies work from a subdomain?

A visitor comes, I immediately set a cookie for him, then there is a redirect to the mobile version if he came from a mobile phone. But in fact, I put the cookie on the regular version of the site yet. Would it be possible to see it in $_COOKIES from m.site.com ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2016-08-16
Pyan @marrk2

yes it works like this:

setcookie('cookies-name', 'cookies-value', time()+3600 * 24 * 365, "/", ".mysite.com");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question