PHP中设置Session选项的方法及参数详解
需积分: 0 85 浏览量
更新于2024-01-23
收藏 1.86MB DOCX 举报
Day 21 Notes 1: Session_set_cookie_params() is used to set a PHP configuration option. It is recommended to use this method. The parameters for this function include the expiration time, the valid path, the valid domain, whether to only transmit over a secure connection, and whether to use the HTTPONLY flag.
In terms of syntax, there are some issues with SESSION. It supports multiple data types. The byte unit is used to measure storage space, where 1 byte is equal to 8 bits. The minimum storage unit is a bit. Bandwidth is measured in bits, for example, 10Mbit. It is important to note that for object-type data, when storing an object in a session, you need to retrieve the corresponding object class using Unserialize(). Why? Because the data stored in the session is serialized.
To use sessions in PHP, you need to enable it first. It is recommended not to automatically start sessions. Opening the session multiple times will result in ignoring the subsequent openings, but it will trigger a notice-level error. To solve this issue, you can add "@" to suppress the error when opening the session.
Session attributes have default values. The session expires when the browser is closed by default. The valid path is set as "/," which means it is valid for the entire website. The valid domain is set as the current domain by default. The options for whether to only transmit over a secure connection and whether to use the HTTPONLY flag are both set as non-default.
The source of session attributes is stored in the COOKIE.
Overall, Session_set_cookie_params() is a useful function for setting PHP configuration options related to sessions. It is important to be aware of the syntax and to properly manage the opening and closing of sessions to avoid errors. The session attributes also play a crucial role in determining the behavior and security of the session.
2022-08-03 上传
2022-08-03 上传
2022-08-08 上传
2016-10-22 上传
2017-07-11 上传
2017-07-13 上传
不美的阿美
- 粉丝: 23
- 资源: 292
最新资源
- 探索数据转换实验平台在设备装置中的应用
- 使用git-log-to-tikz.py将Git日志转换为TIKZ图形
- 小栗子源码2.9.3版本发布
- 使用Tinder-Hack-Client实现Tinder API交互
- Android Studio新模板:个性化Material Design导航抽屉
- React API分页模块:数据获取与页面管理
- C语言实现顺序表的动态分配方法
- 光催化分解水产氢固溶体催化剂制备技术揭秘
- VS2013环境下tinyxml库的32位与64位编译指南
- 网易云歌词情感分析系统实现与架构
- React应用展示GitHub用户详细信息及项目分析
- LayUI2.1.6帮助文档API功能详解
- 全栈开发实现的chatgpt应用可打包小程序/H5/App
- C++实现顺序表的动态内存分配技术
- Java制作水果格斗游戏:策略与随机性的结合
- 基于若依框架的后台管理系统开发实例解析