Home > Backend Development > PHP Problem > What should I do if I can't get the php cookie?

What should I do if I can't get the php cookie?

hzc
Release: 2023-03-01 16:46:01
Original
2282 people have browsed it

What should I do if I can't get the php cookie?

#php What should I do if I can’t get the cookie?

The default path of setcookie() is in the current directory. If other directories want to access this cookie, it will not be accessible.

If this parameter is set to '/', the cookie will be Valid in the entire domain

If set to '/foo/', the cookie will only be valid in the /foo/ directory and its subdirectories under the domain

For example, /foo/bar/. The default value is the current directory where the cookie is set.

只需要更改路径就可以了
setcookie("viewlist",1,time()+3600*24*365,'/');
Copy after login

Recommended tutorial: "php tutorial"

The above is the detailed content of What should I do if I can't get the php cookie?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template