THINKPHP中设置session值保存登录状态
2022-07-28 14:14:58
130
{{single.collect_count}}

1. 使用session之前,先开启session。

- session_start()

2. 存储session值

- session_start();

- $_SESSION[‘access_token’]=‘caf2e61cd13ada99fc650e6908c7’;

3. 获取session值

- session_start();

- echo $_SESSION[‘access_token’];

4. 删除和销毁session

- 删除某个session值用unset($_SESSION[‘name’]);

- 删除所有session值用session_destroy();

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}