Home > Backend Development > PHP Tutorial > 怎么设置cookie作用域

怎么设置cookie作用域

PHPz
Release: 2020-09-04 14:22:34
Original
3566 people have browsed it

设置cookie作用域的方法:首先找到php的“setcookie();”;然后修改代码为“setcookie('name','zhangsan',0,'/', '.baidu.com'”)即可设置指定的作用域。

怎么设置cookie作用域

怎么设置cookie作用域?

提出问题:

php 的 setcookie('name','zhangsan',0,'/');这样的cookie种下之后发现

它的作用域是 www.baidu.com

如何将这个cookie作用域设置为 .baidu.com 呢?

解决方法:

setcookie('name','zhangsan',0,'/', '.baidu.com');
Copy after login

更多相关技术知识,请访问PHP中文网

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