5

php 中session_set_cookie_params 和 setcookie 函数的区别与用法

 2 years ago
source link: https://blog.p2hp.com/archives/10279
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

php 中session_set_cookie_params 和 setcookie 函数的区别与用法

session_set_cookie_params() 函数不管刷不刷新页面,都不会改变cookie的过期时间,

但setcookie() 函数页面每刷新一次,cookie 的过期时间就会刷新一次。

在php7.2 的环境下使用 session_set_cookie_params() 函数会提示报错,Cannot change session cookie parameters when session is active

if(isset($_SESSION)){
session_destroy();
}

在设置之前把已存在的活体销毁就不会再报错了

 12345
6789101112
13141516171819
20212223242526
2728  
« 1月    

归档

日志总数:2296篇 评论总数:247条
分类总数:26个 标签总数:348个
友情链接:13个 网站运行:4033天
最后更新:2023年2月19日

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK